This article will explain how to customize stylesheets to be specific to a locale. This is useful when authoring in different locales which require a different font family and/or page orientation (for example, right to left).
There are two methods of achieving this. We are going to use the English Locale and the Arabic Locale for our examples. Both approaches require that you create a new stylesheet. You can find out how to do this here: https://innovasys.zendesk.com/hc/en-gb/articles/360000905866-How-To-Add-A-New-Stylesheet-To-Your-Project
Method 1 - Create a Locale-Specific Stylesheet in a locale folder
Once you have created your custom stylesheet, you need to open the project directory in Windows Explorer, and create a folder named stylesheets.ar and put the stylesheet in that newly created folder. Note, you would need to substitute ar for the language code for the locale you wish to have a specific locale - we are using ar in this case for Arabic.
You can find other Language codes located here: https://msdn.microsoft.com/en-us/library/ms533052(v=vs.85).aspx
The stylesheet in that folder will be automatically used in preference to any stylesheet with the same filename in the regular stylesheets folder when building the output for that locale code.
Method 2 - Using Build Flags
The second method would be to create and apply build flags. To do this, you need to:
- Create two build flags - one named "Arabic Only" and another named "English Only".
- Create filtering rules in your primary (in this example, English) Build Profile to exclude any content that has the "Arabic Only" build flag - you will then use the primary Build Profile only to build your Primary Locale content. To do this, you need to open the build profile editor for the primary build folder, and then switch to the Filtering page. Set the filter kind to "Exclusion", then click Add New Rule which will bring up a drop-down menu of options. From there, you need to select "Build Flag Rule", and then select the "Arabic Only" build flag.
- Create a secondary Build Profile named "Arabic Only" that you will use to build Arabic locale, and create a filtering rule (as you did above) to exclude any content that has the "English Only" build flag - to do this, you need to repeat the above steps in the secondary build profile editor, but when you select a flag for the filtering rule, you need to select the "English Only" flag.
- Add the "English Only" build flag to your existing stylesheet - to do this, you must right click the stylesheet in the project explorer and then select the build flag from the context menu.
- Finally, you need to create a secondary custom stylesheet (by selecting "New Stylesheet" on the "Project" ribbon tab) and then apply the "Arabic Only" build flag to it.
The advantage of this second method is it will allow you to use the Preview mode inside Document! X (by selecting one of the Build Profiles and choosing "Content Editor Default" from the context menu).