Sails app

This commit is contained in:
Ben Ramey
2014-03-08 18:32:43 -06:00
parent fb64ad1f45
commit 2a34de5580
44 changed files with 5802 additions and 0 deletions

24
config/locales/_README.md Normal file
View File

@@ -0,0 +1,24 @@
# Internationalization / Localization Settings
## Locale
All locale files live under `config/locales`. Here is where you can add locale data as JSON key-value pairs. The name of the file should match the language that you are supporting, which allows for automatic language detection based on the user request.
Here is an example locale stringfile for the Spanish language (`config/locales/es.json`):
```json
{
"Hello!": "Hola!",
"Hello %s, how are you today?": "¿Hola %s, como estas?",
}
```
## Usage
Locales can be accessed in controllers/policies through `res.i18n()`, or in views through the `__(key)` or `i18n(key)` functions.
Remember that the keys are case sensitive and require exact key matches, e.g.
```ejs
<h1> <%= __('Welcome to PencilPals!') %> </h1>
<h2> <%= i18n('Hello %s, how are you today?', 'Pencil Maven') %> </h2>
<p> <%= i18n('That\'s right-- you can use either i18n() or __()') %> </p>
```
## Configuration
Localization/internationalization config can be found in `config/i18n.js`, from where you can set your supported locales.

3
config/locales/de.json Normal file
View File

@@ -0,0 +1,3 @@
{
"Welcome": "Wilkommen"
}

3
config/locales/en.json Normal file
View File

@@ -0,0 +1,3 @@
{
"Welcome": "Welcome"
}

3
config/locales/es.json Normal file
View File

@@ -0,0 +1,3 @@
{
"Welcome": "Bienvenido"
}

3
config/locales/fr.json Normal file
View File

@@ -0,0 +1,3 @@
{
"Welcome": "Bienvenue"
}