forensic-architecture / timemap

Exploration, monitoring and classification of incidents in time and space.
Other
348 stars 58 forks source link

Improve localization features #5

Open francamps opened 6 years ago

francamps commented 6 years ago

Map2d currently has some localization features. src/js/copy.json is thought of as a localization device that contains all translations. It contains the interface copy text as well as dictionaries for recurrent words in the data served by the server. Components default to English (en-US), but can allow toggling between different languages.

{
  "es-MX": {
       "loading": "Cargando...",
       "legend": {

       },
       "toolbar": {

       },
       "other stuff": {

       }
   },
   "en-US": {

   }
}

Additionally, src/js/es-MX.json is an additional file that contains sets of property labels localized in a particular language (in this case, es-MX, Mexican Spanish). Note that this file is named exactly like the language codes available in copy.json.

Toolbar.jsx should contain a button that switches between the available languages in the Redux store, which align coincide with the languages available in copy.json. Note that in the Redux store (src/store/initial.js) you'll find the language code in app.language, which defaults to en-US.

francamps commented 6 years ago

As it is, the application does not currently support RTL languages. Check #6.

jlieb10 commented 5 years ago

@francamps Could you help me understand what is wrong with the code that has been commented out? The toggle seems to be working for me after I uncomment the relevant code in Toolbar.jsx

francamps commented 5 years ago

@jlieb10 It's possible that it works well but some aspects of it are a little bespoke and we decided to hide the feature until we have time to develop a more standard solution which could include more languages and also RTL.

breezykermo commented 3 years ago

@1cgonza this might be helpful if you are looking to make a PR with your Spanish localizations :)