-
#4679
eb84bebcThanks @codingjoe! - Move localize setup to resolve import loop -
Updated dependencies [
feccc1ba]:- lit@3.2.0
-
#4326
75943d95- Loosen type for the@localized()decorator to be able to decorate anyReactiveControllerHostwhich also alleviates type errors that could arise with multiple copies of@lit/reactive-elementpresent in the project. Also remove dependency on@lit/reactive-elementas it is already covered by thelitdependency. -
#4299
fffa4406- Update version range forlitdependency to include v2 (and/or@lit/reactive-elementv1). This allows projects still on lit v2 to use this package without being forced to install lit v3.
-
Updated dependencies:
- @lit/reactive-element@2.0.0
- lit@3.0.0
-
Updated dependencies [
6b515e43,0f6878dc,2a01471a,2eba6997,d27a77ec,6470807f,09949234]:- @lit/reactive-element@2.0.0-pre.1
- lit@3.0.0-pre.1
-
Updated dependencies [
be72f66b,dfd747cf,23c404fd,1db01376,6f2833fd,c3e473b4,92cedaa2,7e8491d4,23326c6b,f06f7972]:- @lit/reactive-element@2.0.0-pre.0
- lit@3.0.0-pre.0
-
#3198
0162fbad- TS sources are now inlined in the JS source maps -
Updated dependencies [
daddeb34,6361a4b4,ae6f6808]:- lit@2.3.0
- @lit/reactive-element@1.4.0
- #2188
9fc5a039- Support emitting generated modules as.jsfiles. Adds a newoutput.languagesetting for runtime mode locale generation, and automatically detects the filetype based on the file extension when usingoutput.localeCodesModule.
-
Updated dependencies [
ff0d1556,15a8356d,2b8dd1c7,34280cb0,5768cc60,018f6520,5fabe2b5,0470d86a,5fabe2b5,52a47c7e,5b2f3642,5fabe2b5,08f60328,7adfbb0c,5fabe2b5,24feb430,61fc9452,5fabe2b5,13d137e9,5fabe2b5,5fabe2b5,724a9aab,0312f3e5,8b6e2415,761375ac,a791514b,5fabe2b5]:- @lit/reactive-element@1.0.0
- lit@2.0.0
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
Added
configureReentrantLocalizationininit/reentrant.jswhich allows for safe concurrent rendering across multiple locales by asynchronous tasks, such as in an SSR context.In this configuration, there is no global
setLocalefunction. Instead, the caller provides agetLocalefunction, which is then called by everymsginvocation.This pairs well with an asynchronous storage manager like
AsyncLocalStorage. SeeconfigureSsrLocalizationfrom@lit/localize-tools/lib/ssr.jswhich does exactly this.
- Removed accidental export of
_msg(usemsginstead).
- Internal refactoring.
- Bumped versions of deps
-
[BREAKING] Lit dependency upgraded to v2.
-
[BREAKING] The
Localizedmixin has been replaced with the@localizeddecorator and theupdateWhenLocaleChangesfunction. These APIs register a Lit 2 controller that serves the same purpose as the removed mixin.import {LitElement} from 'lit-element'; import {Localized} from '@lit/localize/localized-element.js'; class MyElement extends Localized(LitElement) {}
import {LitElement, customElement} from 'lit'; import {localized} from '@lit/localize'; @localized() @customElement('my-element'); class MyElement extends LitElement {}
import {LitElement} from 'lit'; import {updateWhenLocaleChanges} from '@lit/localize'; class MyElement extends LitElement { constructor() { super(); updateWhenLocaleChanges(this); } }
- [BREAKING] Description comments (
// msgdesc:) have been removed in favor of thedescoption.
Before:
// msgdesc: Home page
class HomePage {
hello() {
// msgdesc: Greeting to Earth
return msg(html`Hello World`);
}
goodbye() {
// msgdesc: Farewell to Earth
return msg(html`Goodbye World`);
}
}After:
class HomePage {
hello() {
return msg(html`Hello World`, {
desc: 'Home page / Greeting to Earth',
});
}
goodbye() {
return msg(html`Goodbye World`, {
desc: 'Home page / Farewell to Earth',
});
}
}- [BREAKING] Lit Localize is now distributed as two packages:
@lit/localizeprovides the browser library (msg,LocalizedElement, etc.)@lit/localize-toolsprovides thelit-localizeCLI.
-
[BREAKING] Templates can now contain arbitrary expressions, and no longer need to be wrapped in a function.
Before:
msg((name) => html`Hello <b>${name}</b>!`, {args: [getUsername()]});
After:
msg(html`Hello <b>${getUsername()}</b>!`);
Plain strings containing expressions must now be tagged with the new
strtag. This allows lit-localize to access dynamic values at runtime.import {msg, str} from 'lit-localize'; msg(str`Hello ${name}`);
-
[BREAKING] The
lit-localizeCLI now must always take one of two commands:extractorbuild. Previously, both of these steps were always performed.
- Added
@lit/localize/lib/rollup.jsmodule that exports alocaleTransformersfunction that can be used to integrate locale transformation into a Rollup build.
- Fixed missing
.jsfiles from NPM package.
-
[BREAKING] The signature for the
msgfunction has changed:Before:
msg(id: string, template: string|TemplateResult|Function, ...args: any[])
After:
msg(template: string|TemplateResult|Function, options?: {id?: string: args?: any[]})
-
It is no longer necessary to provide a message
id. When omitted, an id will be automatically generated from the string contents of the template.
// msgdescdescriptions are now correctly emitted as XLIFF<note>elements, instead of crashing.
- Fixed missing
localized-element.jsandconfig.schema.jsonNPM files.
- [BREAKING] NPM package moved from
lit-localizeto@lit/localize.
- Fixed
mainfield ofpackage.jsonso that it resolves tolit-localize.jsinstead of nonexistent file.
- Add optional
output.localeCodesModuleconfig file setting which generates a TypeScript module that exportssourceLocale,targetLocales, andallLocalesusing the locale codes from your config file. Use for keeping your config file and client config in sync.
-
[BREAKING] Published module paths have changed:
lib_client/index.js->lit-localize.jslib_client/localized-element.js->localized-element.js -
When writing TypeScript, XLIFF, and XLB files, parent directories will now be created automatically, instead of erroring.
-
[BREAKING] The
msgfunction has moved from the generatedlocalization.tsmodule to the staticlit-localizemodule.localization.tsis no longer generated, and all of its exports have been replaced by a substantially different API (see the README). -
[BREAKING] The initial locale is no longer automatically initialized from the
localeURL parameter. Initializing/changing locales is now user-controlled. -
[BREAKING] The
tsOutconfig file option is replaced by the newoutputobject, withmode: "runtime"|"transform".
-
Add
transformoutput mode, which emits an entire copy of the program in each locale, where allmsgcalls have been replaced with the raw translated template for that locale. -
Add
configureLocalizationfunction, which returns asetLocaleandgetLocaleobject. -
Add
lit-localize-statusevent, which is dispatched towindowwhenever a locale change starts, completes, or fails. -
Add
Localizedmixin forLitElementcomponents, which automatically re-renders whenever the locale changes inruntimemode.
-
Fix incorrect JSON schema error about
targetLocalesfield not being astring[]. -
Fix bug where
htmltemplates could not contain<!-- comments -->. HTML comments are now preserved as placeholders, similar to other HTML markup.
- Fix missing
<xliff>element in XLIFF output. - Formatting change to XML output (e.g. fewer line breaks).
- Fix incorrect path resolution when loading XLB files.
- Fix errors relating to prettier xml plugin resolution.
- Add missing dependencies (
fs-extra,typescript,prettier).
-
Add support for the XLIFF localization interchange format: https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html
-
[BREAKING] Replaced
xlbDirconfig file property withinterchangeproperty. The interchange format is set withinterchange.format(currentlyxlifforxlb), and other format-specific configuration is set in that object. -
Fix code generation bug where having more than one
targetLocalewould compile to invalid TypeScript (extra commas). -
Disable eslint warnings about camelcase for locale module imports like
zh_CN.ts.
-
Add support for variables:
msg( 'hello', (url: string, name: string) => html`Hello ${name}, click <a href="${url}">here</a>!`, 'World', 'https://www.example.com/' );
-
Interpret paths as relative to the location of the config file, instead of relative to the current working directory.
-
Move
@typespackages fromdependenciestodevDependenciesif they aren't part of any API. In particular, this fixes an error where any package that depended onlit-localizewould need to addDOMto their TypeScriptlibsettings for compatibility with@types/xmldom. -
Publish
.d.tsfiles.
- Initial release of
lit-localize.