anytv-i18n
Advanced tools
Comparing version 2.2.0 to 2.2.1
34
index.js
@@ -186,3 +186,3 @@ 'use strict'; | ||
const fs_promises = fs__default['default'].promises; | ||
const fs_promises = fs__default["default"].promises; | ||
@@ -203,3 +203,3 @@ | ||
this.config = new Config(); | ||
this.locale_folder = path__default['default'].resolve(this.config.get('locale_dir')); | ||
this.locale_folder = path__default["default"].resolve(this.config.get('locale_dir')); | ||
@@ -234,3 +234,3 @@ this.prefix = 'i18n ::'; | ||
this.locale_folder = path__default['default'].resolve(this.config.get('locale_dir')); | ||
this.locale_folder = path__default["default"].resolve(this.config.get('locale_dir')); | ||
@@ -322,4 +322,4 @@ this.metadata_file = this.locale_folder + '/meta.json'; | ||
let str = ___default['default'].get(this.translations, `${ lang }.${ key }`) | ||
|| ___default['default'].get(this.translations, `${ default_lang }.${ key }`) | ||
let str = ___default["default"].get(this.translations, `${ lang }.${ key }`) | ||
|| ___default["default"].get(this.translations, `${ default_lang }.${ key }`) | ||
|| key; | ||
@@ -332,3 +332,3 @@ | ||
*/ | ||
___default['default'](variables).forOwn((value, _key) => { | ||
___default["default"](variables).forOwn((value, _key) => { | ||
str = str.replace(new RegExp(`:${_key}`, 'g'), value); | ||
@@ -343,3 +343,3 @@ }); | ||
this.translations = importer__default['default'].dirloadSync(this.locale_folder); | ||
this.translations = importer__default["default"].dirloadSync(this.locale_folder); | ||
this.debug('from files', Object.keys(this.translations)); | ||
@@ -377,2 +377,4 @@ | ||
*/ | ||
await new Promise(resolve => this.load_files(resolve)); | ||
return; | ||
@@ -382,3 +384,3 @@ } | ||
// download from server on error or REFRESH_TRANSLATIONS | ||
const response = await axios__default['default'].get(this.languages_url); | ||
const response = await axios__default["default"].get(this.languages_url); | ||
@@ -400,3 +402,3 @@ meta = response.data.data; | ||
await new Promise(resolve => { | ||
async__default['default'].each( | ||
async__default["default"].each( | ||
this.languages, | ||
@@ -423,3 +425,3 @@ this.get_lang_files.bind(this), | ||
const translation_file_path = path__default['default'].resolve(path__default['default'].join(this.locale_folder, lang + '.json')); | ||
const translation_file_path = path__default["default"].resolve(path__default["default"].join(this.locale_folder, lang + '.json')); | ||
@@ -449,3 +451,3 @@ for (let retry = 0; retry < MAX_RETRY; retry++) { | ||
const empty_translation = ___default['default'].chain(translation) | ||
const empty_translation = ___default["default"].chain(translation) | ||
.keys() | ||
@@ -460,3 +462,3 @@ .isEmpty() | ||
const service_version = this.config.get('service_version'); | ||
const translation_version = ___default['default'].get( | ||
const translation_version = ___default["default"].get( | ||
translation, '__translation_info.version' | ||
@@ -470,3 +472,3 @@ ); | ||
async download_translations (url, file_path) { | ||
const response = await axios__default['default']({ | ||
const response = await axios__default["default"]({ | ||
method: 'get', | ||
@@ -478,3 +480,3 @@ url, | ||
return await new Promise((resolve, reject) => { | ||
let file_handle = fs__default['default'].createWriteStream(file_path, { autoClose: true}); | ||
let file_handle = fs__default["default"].createWriteStream(file_path, { autoClose: true}); | ||
@@ -490,4 +492,4 @@ response.data.pipe(file_handle); | ||
ensure_dir_existence(dir_path) { | ||
if (!fs__default['default'].existsSync(dir_path)){ | ||
fs__default['default'].mkdirSync(dir_path, { recursive: true }); | ||
if (!fs__default["default"].existsSync(dir_path)){ | ||
fs__default["default"].mkdirSync(dir_path, { recursive: true }); | ||
} | ||
@@ -494,0 +496,0 @@ } |
{ | ||
"name": "anytv-i18n", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A module for globalization", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15354
354