-
Notifications
You must be signed in to change notification settings - Fork 206
Localization docs #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localization docs #189
Conversation
A live preview of this PR will be available at the URL(s) below. https://pr189-8122987---lit-dev-bvxw3ycs6q-uw.a.run.app/ |
e588548
to
1d3660c
Compare
@@ -40,6 +40,10 @@ article { | |||
* Body text | |||
* ------------------------------------ */ | |||
|
|||
article { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be useful to separate the style changes into their own PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #204
key: Overview | ||
order: 1 | ||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a little introduction to what the library is.
"@lit/localize is a library and command-line tool for localizing web applications that are based on lit-html and LitElement."
Seems fine enough for a start. It could also describe localization a bit.
I think the features from the readme would be good to include too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
order: 1 | ||
--- | ||
|
||
## Install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Install | |
## Installation |
? Seems to make other noun-phrased headers in our docs like "Overview", etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
npm i -D @lit/cli | ||
``` | ||
|
||
## Msg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Msg | |
## msg() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems confusing as a header. Should this be like Defining messages
? Or "Identify localizable content: msg()"
... Dunno, just wish there were some words here.
Signed,
Anonymous word fan
|
||
```sh | ||
npm i @lit/localize | ||
npm i -D @lit/cli |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lit/cli
er... does this exist? :) I'm assuming we won't get to it in time, so use the localize CLI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha yeah, these docs are actually written somewhat aspirationally. Right now I'm thinking maybe we launch localize after the main launch, unless we end up with some more time. I'd really like to factor out the CLI and improve it in the ways shown here (maybe can get it done some weekend...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use the @lit/localize-tools
command.
|
||
## Msg | ||
|
||
Wrap Lit templates in the `msg` function to make them localizable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend making this read a little more naturally, and maybe bring that last sentence up because it shows that it's just a pass-through by default.
Wrap Lit templates in the `msg` function to make them localizable. | |
`msg()` wraps Lit templates to make them localizable. | |
`msg()` allows the `@lit/localize` CLI to extract messages needing to be translated, and replace them with translations. Before you have any translations available, the `msg` function simply returns the unmodified template, so it's safe to start using even if you're not yet ready for localization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Use the `lit localize build` command to incorporate translations back into your | ||
application, using one of two modes. | ||
|
||
### Transform mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about including the table on modes features from the README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the key stuff is already explained in the text, plus the table is kind of chunky (it doesn't work on mobile, would need to reformat).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed comments, and updated to use the @lit/localize-tools
command, and remove features that aren't implemented yet.
key: Overview | ||
order: 1 | ||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
order: 1 | ||
--- | ||
|
||
## Install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
```sh | ||
npm i @lit/localize | ||
npm i -D @lit/cli |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use the @lit/localize-tools
command.
npm i -D @lit/cli | ||
``` | ||
|
||
## Msg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
## Msg | ||
|
||
Wrap Lit templates in the `msg` function to make them localizable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Use the `lit localize build` command to incorporate translations back into your | ||
application, using one of two modes. | ||
|
||
### Transform mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the key stuff is already explained in the text, plus the table is kind of chunky (it doesn't work on mobile, would need to reformat).
I don't see any blockers except I feel like this should be in the Related libraries section as originally planned. Would love to see a more descriptive header than OK, technically maybe that's internationalizing templates. Making them localizable. |
I renamed it "Making templates localizable" |
Fixes #28