- Updated dependencies [
feccc1ba
]:
-
#4503
350147d6
- Fix an issue where runningextract
on an existing translation target would rewrite the "id" for placeholders signifying the expression index, which breaks translation targets where the expressions need to be reordered. -
#4530
258142d2
- Translated message validation that runs before thebuild
step now disregards template literal expressions. This allow source code to have variables in expressions renamed while still keeping the same translations, or avoid errors that could happen from module import order changing which expression gets picked up first when multiplemsg()
calls with the same id have different expressions. This behavior is more consistent with how a translation unit is identified according to how the message id is generated.
- #4299
fffa4406
- Update version range forlit
dependency to include v2 (and/or@lit/reactive-element
v1). This allows projects still on lit v2 to use this package without being forced to install lit v3.
- #4141
6b515e43
- Update TypeScript to ~5.2.0, which includes breaking changes to the TypeScript compiler APIs
- Updated dependencies:
- Updated dependencies [
6b515e43
,0f6878dc
,2a01471a
,2eba6997
,d27a77ec
,6470807f
,09949234
,d1e126c4
]:
- #3814
23326c6b
- Update to TypeScript 5.0, which includes breaking changes to the TypeScript compiler APIs.
-
#4175
84bb0523
Thanks @43081j! - Update parse5/tools to simplify importing of node types from the default tree adapter -
#4168
444599eb
Thanks @43081j! - Upgrade parse5 to 7.x in localize-tools and import from root of parse5 where possible
- #3576
6be30739
- Fix regression in Localize XLIFF serialization. When updating an existing XLIFF file, placeholders would appear in the wrong places.
- #3514
78811714
- - Existing XLIFF files will be updated instead of re-generated, so additional data added by other processes (such asstate="translated"
attributes) will be preserved instead of deleted.- XLIFF
<note>
elements generated by Lit Localize will now have afrom="lit-localize"
attribute to distinguish them from other notes.
- XLIFF
- Updated dependencies [
72fcf0d7
]:
-
#3136
afff4c17
- Updated xmldom dependency. Minor change to XML attribute formatting can be expected.
- #2732
3e181bcb
- Enforce use of file extensions in imports. Fixes an issue with older TypeScript compilers.
-
#2561
6be4ac29
- Reorder xliff<note>
elements to follow<target>
elements to be OASIS-compliant -
Updated dependencies [
2c9d0008
]:
-
#2405
4a4afa7b
- BREAKING Update analysis to consider messages with same id and description to be identical (but no longer checks for expressions to be same) and improve error message on finding incompatible duplicates.lit-localize extract
will now error if multiple messages had the same text but differentdesc
option. Be sure to add the samedesc
option for these messages to be considered the same translatable message or add differentid
options to differentiate them. -
#2405
4a4afa7b
- BREAKING (XLB format only) Add index toname
attribute for<ph>
tags for tracking placeholder locations.XLB format users should run
lit-localize extract
to regenerate the.xlb
file for the source locale and make sure the<ph>
tags in other locale files have matchingname
attribute values to that of the newly generated source file.
-
#2275
97f4a3f8
- BREAKING Placeholders containing HTML markup and dynamic expressions are now represented in XLIFF as<x>
tags instead of<ph>
tags.To preserve the previous behavior of using
<ph>
tags, update your JSON config file and setinterchange.placeholderStyle
to"ph"
:{ "interchange": { "format": "xliff", "placeholderStyle": "ph" } }
- #2188
9fc5a039
- Added output.outputDir setting for transform mode. Required if tsConfig is not specified.
- #2188
9fc5a039
- AddinputFiles
field, and maketsConfig
field optional wheninputFiles
is specified. If both are set,inputFiles
takes precedence over the input files fromtsConfig
. WhentsConfig
is not specified, a default config is used that will include.js
files.
- #2188
9fc5a039
- Fixed the$schema
property that is automatically added to @lit/localize-tools config files. It was previously pointing at the incorrect file. - Updated dependencies [
9fc5a039
,9fc5a039
]:- @lit/[email protected]
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.
- Escaped
<
,>
, and&
characters in HTML text content are now preserved when generating runtime & transform mode output. Previously they sometimes were emitted unescaped, generating invalid markup.
-
Added
configureSsrLocalization
in@lit/localize-tools/lib/ssr.js
which allows for safe concurrent rendering of localized templates with@lit-labs/ssr
or other renderers usingAsyncLocalStorage
.import {configureSsrLocalization} from '@lit/localize-tools/lib/ssr.js'; import {render} from '@lit-labs/ssr'; import {html} from 'lit'; const {withLocale} = await configureSsrLocalization({ sourceLocale: 'en', targetLocales: ['es', 'nl'], loadLocale: (locale) => import(`./locales/${locale}.js`)), }); const handleHttpRequest = (req, res) => { const locale = localeForRequest(req); withLocale(locale, async () => { // Any async work can happen in this function, and the request's locale // context will be safely preserved for every msg() call. await doSomeAsyncWork(); for (const chunk of render(msg(html`Hello World`))) { res.write(chunk); } res.end(); }); };
- Fix
Cannot find module '..../@lit/localize/internal/id-generation.js'
error by bumping@lit/localize
dependency.
-
Fix bugs relating to expression values being substituted in duplicate or incorrect order in localized templates.
-
Fix bug relating to
START_LIT_LOCALIZE_EXPR_
strings appearing inside localized templates.
- Fixed missing
str
tag in generated translation templates.
- Update dependencies.
-
[BREAKING] Lit dependency upgraded to v2.
-
[BREAKING] Replaces
Localized
mixin transform with@localized
decorator andupdateWhenLocaleChanges
transforms.
- XLIFF file headers have been simplified to:
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
- [BREAKING] Description comments (
// msgdesc:
) have been removed in favor of thedesc
option.
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',
});
}
}
- Bumped dependency versions for
xmldom
and@lit/localize
-
Initial release of
@lit/localize-tools
package. This new package provides thelit-localize
binary, while@lit/localize
continues to provide the browser library (msg
,LocalizedElement
, etc.). -
BREAKING
lit-localize
now uses JS modules instead of CommonJS, so it requires Node 14 or higher.