@@ -21,11 +21,16 @@ The `lit-localize` module exports the following functions:
2121Set configuration parameters for lit-localize when in runtime mode. Returns an
2222object with functions:
2323
24- - [ ` getLocale ` ] ( #getLocale ) : Return the active locale code.
25- - [ ` setLocale ` ] ( #setLocale ) : Set the active locale code.
24+ - [ ` getLocale ` ] ( #getlocale-string ) : Return the active locale code.
25+ - [ ` setLocale ` ] ( #setlocalelocale-string-promise ) : Set the active locale code.
2626
2727Throws if called more than once.
2828
29+ When in transform mode, the lit-localize CLI will error if this function is
30+ called. Use
31+ [ ` configureTransformLocalization ` ] ( #configuretransformlocalizationconfiguration )
32+ instead.
33+
2934The ` configuration ` object must have the following properties:
3035
3136- ` sourceLocale: string ` : Required locale code in which source templates in this
@@ -52,12 +57,13 @@ const {getLocale, setLocale} = configureLocalization({
5257### ` configureTransformLocalization(configuration) `
5358
5459Set configuration parameters for lit-localize when in transform mode. Returns an
55- object with functions :
60+ object with function :
5661
57- - [ ` getLocale ` ] ( #getLocale ) : Return the active locale code.
62+ - [ ` getLocale ` ] ( #getlocale-string ) : Return the active locale code.
5863
59- (Note that [ ` setLocale ` ] ( #setLocale ) is not available, because changing locales
60- at runtime is not supported in transform mode.)
64+ (Note that [ ` setLocale ` ] ( #setlocalelocale-string-promise ) is not available from
65+ this function, because changing locales at runtime is not supported in transform
66+ mode.)
6167
6268Throws if called more than once.
6369
@@ -74,14 +80,19 @@ const {getLocale} = configureLocalization({
7480});
7581```
7682
83+ In transform mode, calls to this function are transformed to an object with a
84+ ` getLocale ` implementation that returns the static locale code for each locale
85+ bundle. For example:
86+
87+ ``` typescript
88+ const {getLocale} = {getLocale : () => ' es-419' };
89+ ```
90+
7791### ` getLocale(): string `
7892
7993Return the active locale code.
8094
81- In transform mode, calls to this function are transformed into the static locale
82- code string for each emitted locale.
83-
84- ### ` setLocale(locale: string) `
95+ ### ` setLocale(locale: string): Promise `
8596
8697Set the active locale code, and begin loading templates for that locale using
8798the ` loadLocale ` function that was passed to ` configureLocalization ` . Returns a
0 commit comments