@ewb/translate
Advanced tools
Comparing version 1.8.1 to 1.8.2
@@ -28,3 +28,3 @@ import Tree, { WordTranslations, TreeOptions } from './Tree'; | ||
private readonly noTranslation; | ||
constructor({ defaultLocale, locale, words, texts, noMatch, noTranslation }?: TranslateOptions, overrideNew?: boolean); | ||
constructor({ defaultLocale, locale, words, texts, noMatch, noTranslation, }?: TranslateOptions, overrideNew?: boolean); | ||
w(word: string, locale?: string): string; | ||
@@ -53,2 +53,2 @@ word(word: string, locale?: string): string; | ||
} | ||
export { Tree, Empty, Branch, Translate, TranslateOptions, WordTranslations, TreeOptions, Translations, BranchObject, Variables, TextOptions, ISO_639_1, TranslationApi, TranslationUsage }; | ||
export { Tree, Empty, Branch, Translate, TranslateOptions, WordTranslations, TreeOptions, Translations, BranchObject, Variables, TextOptions, ISO_639_1, TranslationApi, TranslationUsage, }; |
@@ -26,3 +26,3 @@ "use strict"; | ||
class Translate { | ||
constructor({ defaultLocale = 'en', locale = 'en', words = {}, texts = {}, noMatch, noTranslation } = {}, overrideNew) { | ||
constructor({ defaultLocale = 'en', locale = 'en', words = {}, texts = {}, noMatch, noTranslation, } = {}, overrideNew) { | ||
this.defaultLocale = ''; | ||
@@ -40,3 +40,3 @@ this.locale = ''; | ||
words, | ||
texts | ||
texts, | ||
}); | ||
@@ -67,3 +67,3 @@ translate = this; | ||
words: this.exportWords(), | ||
texts: this.exportTexts() | ||
texts: this.exportTexts(), | ||
}; | ||
@@ -102,6 +102,6 @@ } | ||
addWords(words) { | ||
Object.keys(words).forEach(key => this.tree.addText(key, words[key])); | ||
Object.keys(words).forEach((key) => this.tree.addWord(key, words[key])); | ||
} | ||
addTexts(texts) { | ||
Object.keys(texts).forEach(key => this.tree.addText(key, texts[key])); | ||
Object.keys(texts).forEach((key) => this.tree.addText(key, texts[key])); | ||
} | ||
@@ -108,0 +108,0 @@ _branch(wordOrText, isText = false) { |
{ | ||
"name": "@ewb/translate", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"description": "Translate as you create your app. Saves the words and text in a tree structure for fast and easy lookup.", | ||
@@ -42,7 +42,2 @@ "main": "./lib/index.js", | ||
], | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged" | ||
} | ||
}, | ||
"devDependencies": { | ||
@@ -49,0 +44,0 @@ "@types/chai": "^4.2.21", |
@@ -45,3 +45,3 @@ import Tree, { WordTranslations, TreeOptions } from './Tree'; | ||
noMatch, | ||
noTranslation | ||
noTranslation, | ||
}: TranslateOptions = {}, | ||
@@ -60,3 +60,3 @@ overrideNew?: boolean | ||
words, | ||
texts | ||
texts, | ||
}); | ||
@@ -95,3 +95,3 @@ | ||
words: this.exportWords(), | ||
texts: this.exportTexts() | ||
texts: this.exportTexts(), | ||
}; | ||
@@ -139,7 +139,7 @@ } | ||
public addWords(words: WordTranslations) { | ||
Object.keys(words).forEach(key => this.tree.addText(key, words[key])); | ||
Object.keys(words).forEach((key) => this.tree.addWord(key, words[key])); | ||
} | ||
public addTexts(texts: WordTranslations) { | ||
Object.keys(texts).forEach(key => this.tree.addText(key, texts[key])); | ||
Object.keys(texts).forEach((key) => this.tree.addText(key, texts[key])); | ||
} | ||
@@ -210,3 +210,3 @@ | ||
TranslationApi, | ||
TranslationUsage | ||
TranslationUsage, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95565