@operato/i18n
Advanced tools
Comparing version 1.4.34 to 1.4.35
@@ -6,2 +6,11 @@ # Change Log | ||
### [1.4.35](https://github.com/hatiolab/operato/compare/v1.4.34...v1.4.35) (2023-08-19) | ||
### :bug: Bug Fix | ||
* unlocalized ox-i18n-selector ([3c21edf](https://github.com/hatiolab/operato/commit/3c21edfb93785eb06657c6785b4105b3db31a12e)) | ||
### [1.4.34](https://github.com/hatiolab/operato/compare/v1.4.33...v1.4.34) (2023-08-19) | ||
@@ -8,0 +17,0 @@ |
import { LitElement } from 'lit'; | ||
declare const I18nSelector_base: (new (...args: any[]) => LitElement) & typeof LitElement; | ||
export declare class I18nSelector extends I18nSelector_base { | ||
export declare class I18nSelector extends LitElement { | ||
static styles: import("lit").CSSResult; | ||
@@ -9,2 +8,1 @@ value: string; | ||
} | ||
export {}; |
import { __decorate } from "tslib"; | ||
import { css, html, LitElement } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
import { localize } from './localize'; | ||
import { i18next } from './config'; | ||
export let I18nSelector = class I18nSelector extends localize(i18next)(LitElement) { | ||
export let I18nSelector = class I18nSelector extends LitElement { | ||
constructor() { | ||
@@ -12,11 +10,11 @@ super(...arguments); | ||
render() { | ||
var _a, _b, _c, _d, _e; | ||
const value = this.value; | ||
return html ` | ||
<select .value=${this.value} @change=${(e) => this.onLocaleChanged(e.target.value)}> | ||
<option value="" ?selected=${!i18next.language}></option> | ||
<option value="en-US" ?selected=${(_a = i18next.language) === null || _a === void 0 ? void 0 : _a.startsWith('en')}>English</option> | ||
<option value="ja-JP" ?selected=${(_b = i18next.language) === null || _b === void 0 ? void 0 : _b.startsWith('ja')}>にほんご</option> | ||
<option value="ko-KR" ?selected=${(_c = i18next.language) === null || _c === void 0 ? void 0 : _c.startsWith('ko')}>한국어</option> | ||
<option value="ms-MY" ?selected=${(_d = i18next.language) === null || _d === void 0 ? void 0 : _d.startsWith('ms')}>Bahasa Malaysia</option> | ||
<option value="zh-CN" ?selected=${(_e = i18next.language) === null || _e === void 0 ? void 0 : _e.startsWith('zh')}>中文</option> | ||
<option value="" ?selected=${!value}></option> | ||
<option value="en-US" ?selected=${value === null || value === void 0 ? void 0 : value.startsWith('en')}>English</option> | ||
<option value="ja-JP" ?selected=${value === null || value === void 0 ? void 0 : value.startsWith('ja')}>にほんご</option> | ||
<option value="ko-KR" ?selected=${value === null || value === void 0 ? void 0 : value.startsWith('ko')}>한국어</option> | ||
<option value="ms-MY" ?selected=${value === null || value === void 0 ? void 0 : value.startsWith('ms')}>Bahasa Malaysia</option> | ||
<option value="zh-CN" ?selected=${value === null || value === void 0 ? void 0 : value.startsWith('zh')}>中文</option> | ||
</select> | ||
@@ -23,0 +21,0 @@ `; |
@@ -5,3 +5,3 @@ { | ||
"author": "heartyoh", | ||
"version": "1.4.34", | ||
"version": "1.4.35", | ||
"main": "dist/src/index.js", | ||
@@ -91,3 +91,3 @@ "module": "dist/src/index.js", | ||
}, | ||
"gitHead": "32dc0f269e61e6f2984fa8b0b8263247061c1ff6" | ||
"gitHead": "fba56d8f1241d264e7fbcca5bf52550b1180ad8e" | ||
} |
import { css, html, LitElement } from 'lit' | ||
import { customElement, property } from 'lit/decorators.js' | ||
import { localize } from './localize' | ||
import { i18next } from './config' | ||
@customElement('ox-i18n-selector') | ||
export class I18nSelector extends localize(i18next)(LitElement) { | ||
export class I18nSelector extends LitElement { | ||
static styles = css` | ||
@@ -40,10 +37,12 @@ * { | ||
render() { | ||
const value = this.value | ||
return html` | ||
<select .value=${this.value} @change=${(e: Event) => this.onLocaleChanged((e.target as I18nSelector).value)}> | ||
<option value="" ?selected=${!i18next.language}></option> | ||
<option value="en-US" ?selected=${i18next.language?.startsWith('en')}>English</option> | ||
<option value="ja-JP" ?selected=${i18next.language?.startsWith('ja')}>にほんご</option> | ||
<option value="ko-KR" ?selected=${i18next.language?.startsWith('ko')}>한국어</option> | ||
<option value="ms-MY" ?selected=${i18next.language?.startsWith('ms')}>Bahasa Malaysia</option> | ||
<option value="zh-CN" ?selected=${i18next.language?.startsWith('zh')}>中文</option> | ||
<select .value=${this.value} @change=${(e: Event) => this.onLocaleChanged((e.target as HTMLSelectElement).value)}> | ||
<option value="" ?selected=${!value}></option> | ||
<option value="en-US" ?selected=${value?.startsWith('en')}>English</option> | ||
<option value="ja-JP" ?selected=${value?.startsWith('ja')}>にほんご</option> | ||
<option value="ko-KR" ?selected=${value?.startsWith('ko')}>한국어</option> | ||
<option value="ms-MY" ?selected=${value?.startsWith('ms')}>Bahasa Malaysia</option> | ||
<option value="zh-CN" ?selected=${value?.startsWith('zh')}>中文</option> | ||
</select> | ||
@@ -50,0 +49,0 @@ ` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
119564
901