You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+65-20Lines changed: 65 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,34 @@
2
2
3
3
[](https://www.npmjs.com/package/lit-localize)[](https://github.com/PolymerLabs/lit-localize/actions?query=workflow%3Atests+branch%3Amaster+event%3Apush)
4
4
5
-
WIP
6
-
7
5
## API
8
6
9
7
The `lit-localize` module exports the following functions:
10
8
9
+
> Note that lit-localize relies on distinctive, annotated TypeScript type
10
+
> signatures to identify calls to `msg` and other APIs during analysis of your
11
+
> code. Casting a lit-localize function to a type that does not include its
12
+
> annotation will prevent lit-localize from being able to extract and transform
13
+
> templates from your application. For example, a cast like
14
+
> `(msg as any)("greeting", "Hello")` will not be identified. It is safe to
15
+
> re-assign lit-localize functions or pass them as parameters, as long as the
16
+
> distinctive type signature is preserved. If needed, you can reference each
17
+
> function's distinctive type with e.g. `typeof msg`.
18
+
11
19
### `configureLocalization(configuration)`
12
20
13
-
Set runtime localization configuration.
21
+
Set configuration parameters for lit-localize when in runtime mode. Returns an
22
+
object with functions:
23
+
24
+
-[`getLocale`](#getlocale-string): Return the active locale code.
25
+
-[`setLocale`](#setlocalelocale-string-promise): Set the active locale code.
14
26
15
-
In runtime mode, this function must be called once, before any calls to `msg()`.
27
+
Throws if called more than once.
28
+
29
+
When in transform mode, the lit-localize CLI will error if this function is
0 commit comments