I18nService is an object that implements internationalization functionality.
- Open your project in the Google Apps Script Dashboard.
- Copy the contents of the i18n.js file and paste it into a new file in your Google Apps Script project.
For detailed documentation, please visit the Wiki page.
const data = {
"bg": {
title: "Тестово приложение"
},
"de": {
title: "Testanwendung"
},
"en": {
title: "Example Application"
},
"ru": {
title: "Тестовое приложение"
},
"uk": {
title: "Тестовий застосунок"
}
};
const i18n = I18nService
.init('ru')
.load(data);
console.log(i18n.getLanguage('en').getTranslate('title'));
console.log(__('title'));
const data = {
title: "Example Application"
};
const locale = "en";
const i18n = I18nService
.init(locale)
.load(data, locale);
console.log(i18n.getLanguage(locale).getTranslate('title'));
console.log(__('title'));
const sheet = SpreadsheetApp
.getActiveSpreadsheet()
.getSheetByName('I18n');
const i18n = I18nService
.init('en')
.load(sheet);
console.log(i18n.getLanguage('en').getTranslate('title'));
console.log(__('title'));
- Add the ability to load translations in
json
format via url-link to theI18n.load()
method. - Use
CacheService
for language storage.
Please read CONTRIBUTING.md for details on how to contribute to this project.
Please refer to CHANGELOG.md for a detailed list of changes and updates.
This project is licensed under the LICENSE.md file.