@ribajs/i18n
Advanced tools
Comparing version 0.17.2 to 0.18.0
{ | ||
"name": "@ribajs/i18n", | ||
"description": "Internationalization extension for Riba.js", | ||
"version": "0.17.2", | ||
"version": "0.18.0", | ||
"author": "Pascal Garber <pascal@jumplink.eu>", | ||
@@ -6,0 +6,0 @@ "url": "https://github.com/ribajs/riba/tree/master/packages/i18n", |
@@ -1,3 +0,3 @@ | ||
import { Utils, ITwoWayBinder, BinderWrapper, Debug, View, JQuery as $ } from '@ribajs/core'; | ||
import { ALocalesService } from '../../services/locales.service'; | ||
import { Utils, ITwoWayBinder, BinderWrapper, JQuery as $ } from '@ribajs/core'; | ||
import { ALocalesService } from '../../services/locales-base.service'; | ||
@@ -81,9 +81,8 @@ // see star.binder.ts | ||
langcode = this.customData.i18n.getLangcode(); | ||
if (!langcode) { | ||
console.error('Langcode is requred', langcode); | ||
return; | ||
} | ||
} | ||
if (!langcode) { | ||
console.error('Langcode is requred', langcode); | ||
return; | ||
} | ||
// translate by using the already translated language variable | ||
@@ -167,3 +166,3 @@ if (this.customData.langVars && this.customData.langVars[langcode]) { | ||
if (this.customData.i18n.ready) { | ||
this.customData.initOnReady(this.customData.i18n.getLangcode(), this.customData.i18n.currentLangcode !== this.customData.i18n.initalLangcode); | ||
this.customData.initOnReady(this.customData.i18n.getLangcode(), this.customData.i18n.currentLangcode !== this.customData.i18n.initalLangcode || !localesService.doNotTranslateDefaultLanguage); | ||
} else { | ||
@@ -170,0 +169,0 @@ this.customData.i18n.event.on('ready', this.customData.initOnReady); |
@@ -1,3 +0,3 @@ | ||
import { Debug } from '@ribajs/core'; | ||
import { ALocalesService } from '../services/locales.service'; | ||
import { Debug, IModuleFormatterWrapper } from '@ribajs/core'; | ||
import { ALocalesService } from '../services/locales-base.service'; | ||
@@ -8,2 +8,5 @@ const translate = async (translateMePathString: string, localesService: ALocalesService, langcode?: string) => { | ||
langcode = localesService.getLangcode(); | ||
if (!langcode) { | ||
return null; | ||
} | ||
} | ||
@@ -21,3 +24,3 @@ return localesService.get([langcode, ...properties]/*, vars */) | ||
export const i18nFormatterWrapper = (localesService: ALocalesService) => { | ||
export const tFormatterWrapper = (localesService: ALocalesService): IModuleFormatterWrapper => { | ||
return { | ||
@@ -24,0 +27,0 @@ name: 't', |
@@ -1,15 +0,23 @@ | ||
// import * as interfaces from './interfaces/interfaces'; | ||
// import * as binders from './binders/i18n.binders'; | ||
// import * as formatters from './formatters/i18n.formatters'; | ||
// import * as services from './services/i18n.services'; | ||
// export { | ||
// binders, | ||
// services, | ||
// formatters, | ||
// interfaces, | ||
// }; | ||
import { IRibaModule } from '@ribajs/core'; | ||
export * from './binders/i18n.binders'; | ||
export * from './formatters/i18n.formatters'; | ||
export * from './services/i18n.services'; | ||
export * from './interfaces/interfaces'; | ||
export * from './binders'; | ||
export * from './components'; | ||
export * from './formatters'; | ||
export * from './interfaces'; | ||
export * from './services'; | ||
import bindersWrapper from './binders'; | ||
import componentsWrapper from './components'; | ||
import formattersWrapper from './formatters'; | ||
import * as services from './services'; | ||
export const i18nModule = (localesService: services.ALocalesService): IRibaModule => { | ||
return { | ||
binders: bindersWrapper(localesService), | ||
components: componentsWrapper(localesService), | ||
formatters: formattersWrapper(localesService), | ||
services, | ||
}; | ||
}; | ||
export default i18nModule; |
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
52336
41
1372
85
1
2
1
12