Last active
May 31, 2018 21:42
-
-
Save vrumger/618298c5ef179eebc511ca8c8a82eb76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hello_world": "Hello World", | |
"hi": "Hi {{name}}!" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const newI18n = require('new-i18n'); | |
const i18n = newI18n(__dirname, ['en', 'pt']); // You can use `.` instead of `__dirname` | |
console.log('English:', i18n('en', 'hello_world')); | |
console.log('Portuguese:', i18n('pt', 'hello_world')); | |
console.log(i18n('en', 'hi', { name: '...' })); | |
console.log(i18n('pt', 'hi', { name: '...' })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hello_world": "Olá Mundo", | |
"hi": "Oi {{name}}!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment