Skip to content

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

Merged
merged 6 commits into from
Apr 21, 2021
Merged

Localization docs #189

merged 6 commits into from
Apr 21, 2021

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Feb 28, 2021

Fixes #28

@github-actions
Copy link

github-actions bot commented Feb 28, 2021

@aomarks aomarks force-pushed the localize-docs branch 2 times, most recently from e588548 to 1d3660c Compare February 28, 2021 01:18
Base automatically changed from new-design-3 to master March 1, 2021 16:36
@@ -40,6 +40,10 @@ article {
* Body text
* ------------------------------------ */

article {
Copy link
Contributor

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

Copy link
Member Author

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
---

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

order: 1
---

## Install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Install
## Installation

? Seems to make other noun-phrased headers in our docs like "Overview", etc

Copy link
Member Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Msg
## msg()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Member Author

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...).

Copy link
Member Author

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.
Copy link
Contributor

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.

Suggested change
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.

Copy link
Member Author

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
Copy link
Contributor

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?

Copy link
Member Author

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).

Copy link
Member Author

@aomarks aomarks left a 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
---

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

order: 1
---

## Install
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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.
Copy link
Member Author

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
Copy link
Member Author

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).

@aomarks aomarks changed the title Localization docs draft, and some docs style improvements Localization docs Apr 20, 2021
@aomarks aomarks requested a review from arthurevans April 20, 2021 18:58
@arthurevans
Copy link
Contributor

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 msg(), like "Localizing templates: msg()" or something like that.

OK, technically maybe that's internationalizing templates. Making them localizable.

@aomarks
Copy link
Member Author

aomarks commented Apr 21, 2021

Would love to see a more descriptive header than msg(), like "Localizing templates: msg()" or something like that.

I renamed it "Making templates localizable"

@aomarks aomarks merged commit 9a08826 into main Apr 21, 2021
@aomarks aomarks deleted the localize-docs branch April 21, 2021 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lit.dev docs for lit-localize
3 participants