mirror of
https://github.com/spacedeck/spacedeck-open.git
synced 2025-12-16 01:47:30 +01:00
Foramontano/adding languages (#89)
- Doc that describes the steps to add a new language to Spacedeck Open - New file with translated entries for using in Spacedeck Open in Spanish - Include 'es' as new locale in Spacedeck Open - Include a radiobutton for users could select the new language
This commit is contained in:
26
docs/adding_languages.md
Normal file
26
docs/adding_languages.md
Normal file
@@ -0,0 +1,26 @@
|
||||
## Adding a new language to Spacedeck Open
|
||||
|
||||
To add a new language to Spacedeck Open, follow these steps:
|
||||
|
||||
*The steps are ilustrated with Spanish (locale 'es') as the new language*
|
||||
|
||||
- Include the new locale ('es') at the locale list (./spacedeck.js)
|
||||
```
|
||||
locales: ["en",..., "es"],
|
||||
```
|
||||
- Create the new translation file (/locales/**es.js** thar it's a copy of /locales/en.js). and translate the entries.
|
||||
- Include the javascript for letting Spanish info accesible (at the end of /views/spacedeck.html)
|
||||
|
||||
```
|
||||
...
|
||||
window.locales.es = {};
|
||||
...
|
||||
window.locales.es.translation = {% include "./../locales/es.js" %};
|
||||
</script>
|
||||
```
|
||||
- Include a radiobutton for users could seleect the new language (/views/partials/account.html)
|
||||
```
|
||||
<label class="radio" v-bind:class="{checked: user.prefs_language=='es'}" v-on:click="save_user_language('es')">
|
||||
<input type="radio" id="user-preferences_language" name="language" value="es"><span>Español</span>
|
||||
</label>
|
||||
```
|
||||
Reference in New Issue
Block a user