Socket
Socket
Sign inDemoInstall

@lion/localize

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/localize - npm Package Compare versions

Comparing version 0.19.0 to 0.20.0

55

CHANGELOG.md
# Change Log
## 0.20.0
### Minor Changes
- 72067c0d: **BREAKING** Upgrade to [lit](https://lit.dev/) version 2
This does not change any of the public APIs of lion.
It however effects you when you have your own extension layer or your own components especially when using directives.
See the [official lit upgrade guide](https://lit.dev/docs/releases/upgrade/).
**BREAKING** Upgrade to [ScopedElements](https://open-wc.org/docs/development/scoped-elements/) version 2
This version of `@open-wc/scoped-elements` is now following the [Scoped Custom Element Registries](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Scoped-Custom-Element-Registries.md) and automatically loads a polyfill [@webcomponents/scoped-custom-element-registry](https://github.com/webcomponents/polyfills/tree/master/packages/scoped-custom-element-registry).
This means tag names are no longer being rewritten with a hash.
```js
import { css, LitElement } from 'lit';
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
import { MyButton } from './MyButton.js';
export class MyElement extends ScopedElementsMixin(LitElement) {
static get scopedElements() {
return {
'my-button': MyButton,
};
}
render() {
return html`
<my-button>click me</my-button>
`;
}
}
```
```html
<!-- before (ScopedElements 1.x) -->
<my-element>
#shadow-root
<my-button-23243424>click me</my-button-23243424>
</my-element>
<!-- after (ScopedElements 2.x) -->
<my-element>
#shadow-root
<my-button>click me</my-button>
</my-element>
```
### Patch Changes
- Updated dependencies [72067c0d]
- @lion/core@0.18.0
## 0.19.0

@@ -4,0 +59,0 @@

8

docs/overview.md

@@ -12,3 +12,3 @@ # Systems >> Localize >> Overview ||10

Further examples and a more in depth description can be found at the [Features Page](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/features.md).
Further examples and a more in depth description can be found at the [Features Page](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/features.md).

@@ -19,5 +19,5 @@ ## Content

| ---------------------------------------- | --------------------------------------------- |
| [Translate Text](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/text.md) | Load and translate text in multiple languages |
| [Format Numbers](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/numbers.md) | Format numbers in multiple languages |
| [Format Dates](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/dates.md) | Format dates in multiple languages |
| [Translate Text](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/text.md) | Load and translate text in multiple languages |
| [Format Numbers](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/numbers.md) | Format numbers in multiple languages |
| [Format Dates](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/dates.md) | Format dates in multiple languages |

@@ -24,0 +24,0 @@ ## Installation

{
"name": "@lion/localize",
"version": "0.19.0",
"version": "0.20.0",
"description": "The localization system helps to manage localization data split into locales and automate its loading",

@@ -37,3 +37,3 @@ "license": "MIT",

"@bundled-es-modules/message-format": "6.0.4",
"@lion/core": "0.17.0",
"@lion/core": "0.18.0",
"singleton-manager": "1.4.2"

@@ -40,0 +40,0 @@ },

@@ -12,3 +12,3 @@ # Systems >> Localize >> Overview ||10

Further examples and a more in depth description can be found at the [Features Page](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/features.md).
Further examples and a more in depth description can be found at the [Features Page](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/features.md).

@@ -19,5 +19,5 @@ ## Content

| ---------------------------------------- | --------------------------------------------- |
| [Translate Text](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/text.md) | Load and translate text in multiple languages |
| [Format Numbers](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/numbers.md) | Format numbers in multiple languages |
| [Format Dates](https://github.com/ing-bank/lion/blob/4bd5e4fc4dcadd802d0856c0e73e3af559f40537/docs/docs/systems/localize/dates.md) | Format dates in multiple languages |
| [Translate Text](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/text.md) | Load and translate text in multiple languages |
| [Format Numbers](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/numbers.md) | Format numbers in multiple languages |
| [Format Dates](https://github.com/ing-bank/lion/blob/24b272ecf272f883ddb8130e22271557f4ff444e/docs/docs/systems/localize/dates.md) | Format dates in multiple languages |

@@ -24,0 +24,0 @@ ## Installation

@@ -238,5 +238,5 @@ // @ts-expect-error [external]: no types for this package

const namespace = /** @type {string} */ (isDynamicImport
? Object.keys(namespaceObj)[0]
: namespaceObj);
const namespace = /** @type {string} */ (
isDynamicImport ? Object.keys(namespaceObj)[0] : namespaceObj
);

@@ -243,0 +243,0 @@ if (this._isNamespaceInCache(locale, namespace)) {

export type LocalizeMixin = typeof import("../types/LocalizeMixinTypes.js").LocalizeMixinImplementation;
export const LocalizeMixin: typeof import("../types/LocalizeMixinTypes.js").LocalizeMixinImplementation;
export type DirectiveResult = import("@lion/core").DirectiveResult<import("lit/directive").DirectiveClass>;

@@ -5,2 +5,3 @@ import { dedupeMixin, until, nothing } from '@lion/core';

/**
* @typedef {import('@lion/core').DirectiveResult} DirectiveResult
* @typedef {import('../types/LocalizeMixinTypes').LocalizeMixin} LocalizeMixin

@@ -88,3 +89,3 @@ */

* @param {string} [options.locale]
* @return {string | function}
* @returns {string | DirectiveResult}
*/

@@ -91,0 +92,0 @@ msgLit(keys, variables, options) {

@@ -14,8 +14,10 @@ import { formatNumberToParts } from './formatNumberToParts.js';

export function getCurrencyName(currencyIso, options) {
const parts = /** @type {FormatNumberPart[]} */ (formatNumberToParts(1, {
...options,
style: 'currency',
currency: currencyIso,
currencyDisplay: 'name',
}));
const parts = /** @type {FormatNumberPart[]} */ (
formatNumberToParts(1, {
...options,
style: 'currency',
currency: currencyIso,
currencyDisplay: 'name',
})
);
let currencyName = parts

@@ -22,0 +24,0 @@ .filter(p => p.type === 'currency')

@@ -12,8 +12,10 @@ import { formatNumberToParts } from './formatNumberToParts.js';

export function getFractionDigits(currency = 'EUR') {
const parts = /** @type {FormatNumberPart[]} */ (formatNumberToParts(123, {
style: 'currency',
currency,
}));
const parts = /** @type {FormatNumberPart[]} */ (
formatNumberToParts(123, {
style: 'currency',
currency,
})
);
const [fractionPart] = parts.filter(part => part.type === 'fraction');
return fractionPart ? fractionPart.value.length : 0;
}

@@ -12,6 +12,4 @@ import { expect } from '@open-wc/testing';

// @ts-ignore
const {
_autoLoadOnLocaleChange: autoLoadOnLocaleChange,
_fallbackLocale: fallbackLocale,
} = localizeManagerEl;
const { _autoLoadOnLocaleChange: autoLoadOnLocaleChange, _fallbackLocale: fallbackLocale } =
localizeManagerEl;
return {

@@ -18,0 +16,0 @@ autoLoadOnLocaleChange,

@@ -14,6 +14,4 @@ import { expect, oneEvent, aTimeout } from '@open-wc/testing';

// @ts-ignore
const {
__storage: storage,
_supportExternalTranslationTools: supportExternalTranslationTools,
} = localizeManagerEl;
const { __storage: storage, _supportExternalTranslationTools: supportExternalTranslationTools } =
localizeManagerEl;
return {

@@ -20,0 +18,0 @@ storage,

@@ -1,12 +0,4 @@

import { isDirective, LitElement } from '@lion/core';
import {
aTimeout,
defineCE,
expect,
fixture,
fixtureSync,
html,
nextFrame,
unsafeStatic,
} from '@open-wc/testing';
import { isDirectiveResult, LitElement } from '@lion/core';
import { aTimeout, defineCE, expect, fixture, fixtureSync, nextFrame } from '@open-wc/testing';
import { html, unsafeStatic } from 'lit/static-html.js';
import sinon from 'sinon';

@@ -295,3 +287,3 @@ import { localize } from '../src/localize.js';

expect(isDirective(messageDirective)).to.be.true;
expect(isDirectiveResult(messageDirective)).to.be.true;

@@ -333,3 +325,3 @@ await aTimeout(1); // wait for directive to "resolve"

const messageDirective = el.msgLit('my-element:greeting');
expect(isDirective(messageDirective)).to.be.true;
expect(isDirectiveResult(messageDirective)).to.be.true;

@@ -336,0 +328,0 @@ await el.localizeNamespacesLoaded;

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