One of the most powerful features in SYSTRANLinks has to do with Rules. We hear a lot of questions and inquiries from customers who ask “can we do this…” or “how can SYSTRANLinks do that…?”, and so many times, the answer is as simple and elegant as defining a rule. It could be a rule that affects all pages for a given target language. Or it could be a rule that aims at influencing only a few specific pages, or work for all languages. Many other criteria can be applied, and there are a number of powerful rules to chose from, so we thought it would be a good time to show some examples of rules.
Starting with Rules
If you’ve never created a rule, this is where you’ll want to start: the Pages area
As you know, this section shows all the pages that the system is aware of, because someone has visited those pages, or because they are linked from another visited page. Initially, this list of pages may be short, perhaps only showing the home page and a few main pages linked from it, but over time you’ll see many pages, located in many different subdirectories. The tabular display of the pages shows important information about the pages, such as their general status, whether they have been tagged, when they were last visited, or how many sentences and words were found in them.
One of the columns in that tabular view also shows how many rules affect the page, if any. The #Rules, or Number of Rules, column, can tell you if a particular page is subject to or affected by any rules. In the above example, none of the pages show a value. But if you had a rule defined, chances are that some of the pages will show a value of 1, 2 or higher, depending on how many rules are affecting that page.
It is tempting at this point to click on the +Add Rule button, but I’d like to guide your attention first to Rule Settings
What you’ll see initially is very simple: an empty list of rules:
The only thing you’ll initially see there is an opening square braquet ([) followed immediately by a closing square bracket (]).
However, this is an area where you could enter rules already, if you were a master of the format that this rules system understands. For now, let’s simply realize that you can edit the content of this pane, you can click Update to tell the system to analyze and process it, and you can also select, copy and paste to/from it. In other words, it is easy to keep a copy of your rules in a separate document, such as a text file or in notebook. And we recommend you do just that.
Creating your first rule
Ok, It’s time to experiment and discover the power of rules. Start by clicking on Add Rule. There will be a dialog popup window with various options, and some of the options will depend on others, i.e. the parameters that you can specify for some rules will vary with the selected rule type.
Notice that near the top, the first entry asks for a Rule Type. Click the menu to see the available rules, and select one of them.
The first type of rule is “Do not Translate page”. Obviously, this is a rule that normally should be applied to just a few select pages. If the entire target language needs to be disabled and translation of it needs to be prevented, you could simply turn the translation off for that (or those) target language(s) in the main configuration panel.
Still, let’s use this as a first example. Let’s step back and cancel out of this dialog, and start by selecting a specific page. For example, select the ‘about…’ page, if you have one in your website (and which website doesn’t have an ‘about’ page?). Then Click the Add Rule button.
Now that we had a page (or a few pages) selected, this rule will apply to the selected page only, not the entire site. There are other ways to control which pages are affected, as we’ll see soon, but this is a convenient one if you’re dealing with something that only should affect one or a few pages and you can already see the pages because they have been visited and are listed there.
Now, after clicking Add Rule, and after selecting the first type of rule, the Do Not Translate Page rule, you’ll see something like this:
The second field, the Rule path, shows a value that came from the fact that you had pre-selected a file or a folder before clicking Add Rule. But, you can add to it. You can for example enter the name of a folder, or another page, with its full por you could even use wild cards. For example if you have a support section in the website, and none of the pages in your /support directory should be translated, then you could add
To the rule path, separatedby a comma. For example:
If you need to apply a rule to a long list of many files and/or folders, it’s good to know that you can in fact prepare that list elsewhere, such as in Notepad, and copy/paste it into this rule when you’re ready to put it in place within SYSTRANLinks.
The next parameter is ‘Multilingual’, a checkbox that allows you to enforce the rule for any and all target languages. If you don’t check it, only the current language is affected by the rule. That current language is in the header of the interface:
So be sure to check which language you have selected there as the target before entering the rule. In fact, you can change the language now, even if you’re already in the Add Rule dialog. The two resources can be accessed in parallel.
The next parameter is optional, and allows you to place a comment with the rule. This could be a note to self, or perhaps a communication for other collaborators who also work on the site. For example, if the translation needs of the page needs to temporarily be disabled until someone named Dave has had a chance to do a final review, such as for a legal statement or warranty page, it might be entered like this:
Later, you could remove the rule.
Finally, one more option, for this rule: the Publish flag. Make sure you flip the switch to ON, or nothing will happen with the rule.
Then click Add, and you rule is in place and live.
Immediately, you’ll see a change in the tabular Pages view:
In the #Rules column, you’ll now see an abbreviated name of the rule that affects this selected page. DNTP stands of course for Do Not Translate Page. You will see many other abbreviations there in coming days, as you explore and build more rules when needed.
Let’s check now the syntax of this rule, i.e. to look at Rule Settings again, in order to compare to what it contained when no rules had been defined yet.
The Rule Settings panel now show one rule, contained in curly braces. You can select and copy/paste it into another text window.
You’ll notice that the path in this example shows just one file, which was the one I had selected. This is another place where I could add more files or folders, and the wildcard too, in order to make the rule apply to more pages. For example, if I wanted to add the rule to all files in the /support directory and also all files in the /news/2012 directory, I could modify this field like so:
If you make such a change, simply click Update. If there’s a syntax problem or other error, such as if you forget the closing double-quote at the end of the line, the system will show the text in red until you fix it.
You can also see the type of the rule here, by its abbreviation:
The language (lang) parameter is showing the target language, in this case French:
That entry would not be seen if you had checked the box to make the rule apply to all target langauges. Since we left it unchecked, and since the current language was French, that’s what we see in the rule settings. If you change your mind, you can change the target language right there, or delete the line altogether, to make it apply to all languages.
The next line shows if the rule is published, and the last field shows the optional note I may have added.
Ok, so we have learned to use and work with a first rule. Next time we’ll look at rules for specific elements, such as the <TITLE> tag or a menu (SELECT tag). There are many other things we can do, very powerful ways to control what does and what doesn’t get translated, and a lot more. To get you an idea, here are some of the rules currently available:
|Rule Category||Rule Name|
|Translation Rules||Do Not Translate Page|
|Replace Page with File|
|Do Not Translate Element|
|Translate Only Element|
|URL Translation Rules||Translate URL Element|
|Do Not Translate URL|
|Global Page Edit Rules||Add HTML Snippet to document HEAD|
|Add HTML Snippet to document BODY|
|Add CSS rules to page|
|Disable Language Selector|
|Replace Google Analytics ID|
|Local Page Edit Rules||Replace Specific Element|
|Insert Content after specific element|
|Insert Content before specific element|
|Append content to specific element|
Seeing this list, here’s a quiz for you: can you tell which rule you would use to make it so that a visitor to a certain page could no longer change the language as long as they are in that page or set of pages?