wip: migrate from deprecated swig templates to ejs

This commit is contained in:
mntmn
2020-09-09 17:20:35 +02:00
parent b4f0fa16ef
commit a8b8e36ad3
42 changed files with 272 additions and 440 deletions

View File

@@ -2,23 +2,23 @@
To add a new language to Spacedeck Open, follow these steps:
*The steps are ilustrated with Spanish (locale 'es') as the new language*
*The steps are illustrated with Spanish (locale 'es') as the new language*
- Include the new locale ('es') at the locale list (./spacedeck.js)
- Include the new locale ('es') in 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)
- Create the new translation file (/locales/**es.js**, a copy of /locales/en.js) and translate the entries.
- Include the javascript for the new translation at the end of /views/spacedeck.ejs:
```
...
window.locales.es = {};
...
window.locales.es.translation = {% include "./../locales/es.js" %};
window.locales.es.translation = <%- include "./../locales/es.js" %>;
</script>
```
- Include a radiobutton for users could seleect the new language (/views/partials/account.html)
- Include a radio button for users to select 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>