adding_languages.md 965 Bytes
Newer Older
1
2
3
4
## Adding a new language to Spacedeck Open

To add a new language to Spacedeck Open, follow these steps:

5
*The steps are illustrated with Spanish (locale 'es') as the new language*
6

7
- Include the new locale ('es') in the locale list (./spacedeck.js):
8
9
10
```
    locales: ["en",..., "es"],
```
11
12
- 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:
13
14
15
16
17

  ```
    ...
    window.locales.es = {};
    ...
18
    window.locales.es.translation = <%- include "./../locales/es.js" %>;
19
20
  </script>
  ```
21
- Include a radio button for users to select the new language (/views/partials/account.html)
22
23
24
25
26
  ```
    <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>
  ```