Disney language:
- .net language must be installed on machine which builds the solution - if not - it doesn't generate the satellite localization dlls.
Even though the resx files are included into the main dll, the app (web) doesn't access them.
- Create dll which just does the language registration so we can use a powershell script to execute on build (build action).
Check in the custom culture generator dll to 'lib'
Visual Studio - restart to let VS update the .NET language list (especially removing a language)
Sisulizer Tool
We have one license of the software (currently installed on Stefan-PC). It creates translations (resx files) for Visual Studio solutions. Every custom language (i.e. en-US-Disney) needs it's extra set of resource files, generated by Sisulizer.
Install Sisulizer Tool
Either download the tool from https://www.sisulizer.com (Professional Developer version) or get it from network share \\mlsnas\Public\Software\Sisulizer Tool
License key can be found in https://docs.google.com/spreadsheets/d/1eOP-rSso_CzctFzv29Hp-Lw5EIalz72Ym6EE3lEzQzA/edit#gid=711274036
Add New Custom Language to Core
- Open Sisulizer project file /src/MarineLMS - Sisulizer Translation.slp
- Add a new language variant (Tools → General... → Languages)
- Select a specific language you want to create a variant for and click 'Add variant...'.
- Important: you must select a country specific language like EN-US. You can't select just EN.
- Tab Codes: add name for the ISO variant (i.e. Disney). Don't change the Windows code (which is autom. updated if the ISO variant name is added)
- Tab Names: add the same variant names in both text fields as ISO variant (i.e. Disney)
- The resulting custom language will be like EN-US-Disney
- Select a specific language you want to create a variant for and click 'Add variant...'.
- Add new custom language to the slp project
- Open drop down list for languages in tool bar and select Add...
- Select language and add to 'Selected Languages'
- If you add a country specific language (i.e. FR-CA) and the general language (i.e. FR) is not added a warning is issued. Select No
- Select OK to complete adding a new language
- Export resx files into checked out solution/project
- Manually add all resx files to the VS solution/project
- Set the Custom Tool = PublicResXFileCodeGenerator and Custom Tool Namespace for each resx file to match the original neutral resx files.
- Check in the new resx files to Git
- Check in/update the Sisulizer configuration file ('MarineLMS - Sisulizer Translation.slp') to Git
Update Resx Files and/or Make Translations
- Open Sisulizer project file /src/MarineLMS - Sisulizer Translation.slp
- Project → Scan for Changes
- Select All to view all text which can be translated.
- Ctrl + F5 to search for any term you need to translate
- Make any translation/changes you need
- Project → Build in Selected Language will generate the updated/new resx files
- Save the Sisulizer project
- Open MarineLMS solution in Visual Studio
- Include newly created custom language specific resx files (created by Sisulizer) to MarineLMS solution
- The easiest way to find any new resx files created by Sisulizer is to check Sourcetree for uncommitted changes/unstaged files
- In VS, right click resx file and select Include in Project (enable Show All Files in the Solution Explorer)
- Update the newly added resx file's properties (2) to match the values of the counterpart's resx file (= default language resx file)
- Custom Tool: PublicResXFileCodeGenerator
- Custom Tool Namespace: [[namespace from corresponding default resx file]]
- Example: if you added AssessmentSummaryRx.en-US-Disney.resx, there is always a resx file AssessmentSummaryRx.resx.
- Include newly created custom language specific resx files (created by Sisulizer) to MarineLMS solution
- Commit all resx files and the Sisulizer project file /src/MarineLMS - Sisulizer Translation.slp and /src/MarineLMS - Sisulizer Translation.sds
Support Language Specific Date/Time Formats
In order to support different date and time formats for different locales all UI elements need to use the ILMSFormatter interface (class Formatters). The Formatters' Resx file contains date and time formats. Sisulizer context: MarineLMS.Web.Main\MarineLMS.Web.Main.csproj.Strings.MarineLMS.Web.Main.Util.FormattersRx.
Support Language Specific DatePicker
The Bootstrap date picker needs a separate js file for translations for different locales. For example bootstrap-datepicker.fr.min.js for French. The date picker doesn't support country specific language translations. That is, country specific languages like fr-CA and fr-FR would refer to fr only.
The following steps need to be done to add a new language to Visual Studio project Web.Main:
- Download date picker js language file from https://github.com/uxsolutions/bootstrap-datepicker/tree/master/js/locales
- Add the js file to Main.Web \Scripts\libs
- Add reference in Global.asax.cs for the the new js file: bundles.Add(new ScriptBundle("~/Scripts/marinelms.js").Include (i.e. "~/Scripts/libs/bootstrap-datepicker.fr.min.js,")
Use DatePicker in cshtml
The date picker classes data-date-format and data-date-language must exist and have the correct values.
div class="input-append date pull-left input-datepicker" data-date-format="@Model.DateFormatter.ShortDateAllNumbersFormat" data-date-language="@Model.DateFormatter.CurrentTwoLetterISOLanguageName" title="start date">
data-date-format: The date format for the DatePicker must contain numbers only - no month name like Jan or January is allowed.
data-date-language: The date language must be the 2 letter language name like en, fr,... The language name like 'fr' is deferred from the js script like 'bootstrap-datepicker.fr.min.js'.
Notes
Only Core web projects currently contain resx files and therefore only Core web projects are imported into Sisulizer.
Handling Resx Files and Keys in VS Solution
In general, you only need to worry about the English (default) resx files in the VS solution. All other language specific resx files (translations) are maintained by Sisulizer tool. There are a few exceptions when adding new/removing resx files (see below for more details).
Don't change/update any names/values within a translation resx file. Changes to translation resx files will be ignored and overwritten by Sisulizer. Any update to a translation must be done in Sisulizer to take effect. Having said that, changes to default resx files must be done in VS solution to take effect because Sisulizer will read the default resx file as 'truth'.
Default resx file: VS solution is the authoritative truth and changes flow from VS solution → Sisulizer
Translation resx files: Sisulizer is the authoritative truth and changes flow from Sisulizer → VS solution
Add new Resx File
If you need to add a new resx file, add the default resx file only (i.e. AssessmentSelectorControllerRx.resx). Any translation resx files and their names/values are handled by Sisulizer (i.e. AssessmentSelectorControllerRx.fr-CA.resx and AssessmentSelectorControllerRx.en-US-Disney.resx).
Edit Existing Resx Name/Value
Only update the default resx file - updates to translation resx files are handled by Sisulizer.
Remove Resx File
Delete all resx files (default and all translations) from the VS solution. Sisulizer will catch up on the changes because the default resx file was removed. If translation resx files were left in place they'd become orphaned because Sisulizer wouldn't delete or even read them once the default resx file was removed.
Move Resx File to Other Location in Solution
Only move the default resx file to the new location. Delete any translation resx files of the moved file from the VS solution. Sisulizer will generate new translation resx files for the moved default resx file. Translation resx files could be moved to their new location too so the files wouldn't need to be re-added to the VS solution later on.
Trips and Pitfalls
Related articles
Filter by label
There are no items with the selected labels at this time.
0 Comments