Skip to content
Arjen van Bochoven edited this page Apr 16, 2017 · 5 revisions

When you are developing for MunkiReport, please make sure all the user facing text strings you use are provided via the i18n localization framework.

Files

The JSON localization files are located in multiple spots. The general locales are in assets/locales, the module specific locales are in app/modules/{module name}/locales/. Please note that when the module is not loaded, the locales are not loaded as well.

The JSON format has some restrictions in the use of quotations etc. so please make sure the locale files are valid JSON, you can check your file using a validator like jsonlint.com.

Translation tool

If you want to help translate strings to a particular language, this hosted instance of the i18next-editor is a great help. Load the en.json in the left pane, the other language file in the right pane and click on 'Generate input fields'. When you're done you click on 'Generate JSON' and you have the formatted language JSON text to add to your translation file.

dataTables

When you're adding an additional language, make sure you add the appropriate localization file for assets/locales/dataTables as well, the tables won't load if it can't find the locale file. You can find dataTables locale files in the dataTables github repo. Make sure you:

  • remove the comments at the beginning of the file
  • remove the sProcessing property (MunkiReport shows a spinner instead)
  • remove the colon (:) from sSearch (MunkiReport moves this into the placeholder)

Some things to keep in mind

  • Place generic words like 'computer', 'memory', 'hour' in the root of the JSON object
  • Try to find an appropriate place for other words and sentences (look at what's already localized)
  • English is the fallback language, so make sure the strings are at least available in en.json
  • Try to keep the JSON files alphabetically organized, this will make it a lot easier for people maintaining localization files. (This is easy when using a JSON prettifier like https://github.com/federomero/pretty-json)
Clone this wiki locally