Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ribajs/i18n

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ribajs/i18n - npm Package Compare versions

Comparing version 0.18.1 to 0.18.2

5

package.json
{
"name": "@ribajs/i18n",
"description": "Internationalization extension for Riba.js",
"version": "0.18.1",
"version": "0.18.2",
"author": "Pascal Garber <pascal@jumplink.eu>",

@@ -24,3 +24,4 @@ "url": "https://github.com/ribajs/riba/tree/master/packages/i18n",

"build": "npm run build:module",
"build:module": "tsc"
"build:module": "tsc",
"link": "npm link; npm link @ribajs/core"
},

@@ -27,0 +28,0 @@ "devDependencies": {

1

src/components/switcher/switcher.component.ts

@@ -115,2 +115,3 @@ import {

protected setLangcode(langcode: string) {
this.debug('setLangcode', langcode);
this.localesService.setLangcode(langcode);

@@ -117,0 +118,0 @@ }

@@ -119,2 +119,3 @@ import { Utils, EventDispatcher, Debug } from '@ribajs/core';

if (this.currentLangcode !== langcode) {
this.debug('setLangcode', langcode, this.currentLangcode);
this.currentLangcode = langcode;

@@ -203,12 +204,8 @@

protected init() {
protected async init() {
this.initalLangcode = this.getHTMLLangcode();
this.currentLangcode = this.initalLangcode;
this._ready = true;
if (!this.initalLangcode ) {
throw new Error(`The lang attribute on the html element is requred to detect the default theme language: ${this.initalLangcode}`);
}
}
protected async switchToBrowserLanguage() {
// Detect browser language and switch to this language when available

@@ -231,2 +228,3 @@ const browserLangcode = this.getBrowserLangcode();

.then((availableLangcodes) => {
this._ready = true;
// If the current langcode is not the inital langcode then translation is needed

@@ -233,0 +231,0 @@ const translationNeeded = this.currentLangcode !== this.initalLangcode || !this.doNotTranslateDefaultLanguage;

@@ -40,4 +40,2 @@ import { Debug, Utils } from '@ribajs/core';

this.init();
if (LocalesRestService.instances[this.url]) {

@@ -47,4 +45,3 @@ return LocalesRestService.instances[this.url];

this.switchToBrowserLanguage();
this.init();
LocalesRestService.instances[this.url] = this;

@@ -73,4 +70,5 @@ }

return Utils.getJSON(url)
.then((locals: any /** TODO any */) => {
this.locales[url as string] = locals;
.then((locales: any) => {
this.locales[url as string] = locales;
this.debug('getAll', locales);
return this.locales[url as string];

@@ -77,0 +75,0 @@ });

@@ -31,4 +31,2 @@ import { Debug } from '@ribajs/core';

this.init();
if (LocalesStaticService.instances[id]) {

@@ -38,4 +36,3 @@ return LocalesStaticService.instances[id];

this.switchToBrowserLanguage();
this.init();
LocalesStaticService.instances[id] = this;

@@ -42,0 +39,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc