Skip to content

Commit

Permalink
Add documentation about extension localization
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 committed Jan 19, 2024
1 parent ada3e49 commit 8b43df9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,39 @@ WebExtensions message format, with a few differences:
* Referencing other messages is possible, include a placeholder to another key in the placeholder content.
* Limited pluralization is possible, supporting a very basic subset of the ICU message pluralization format.

The pluralization support is based on a very basic subset of the ICU message
pluralization syntax, with the following limitations:

* Supports only the pluralization type (`plural`).
* Supports only one variable key.
* Does not support nested messages.
* Only supports `#` placeholder inside messages.

As Crowdin is compatible with this format, you mostly don't need to worry about
these changes if you are translating through Crowdin. More details about special
features can be found [in a Crowdin discussion](https://crowdin.com/project/firefoxpwa/discussions/2).

<details>
<summary>Notes for developers</summary>

The localization messages are stored in a WebExtensions-compatible format.
When creating a new message, please make sure that it follows the same
message ID style as other messages and contains an appropriate description.

When creating an HTML element that needs to be translated, add a `data-i18n`
attribute with its content set to the message ID. If you need to translate
specific attributes, you can set `data-i18n-ATTRIBUTE-NAME` to the message
ID. Even if the element only uses attribute translations, it still needs
a `data-i18n` attribute, but it can be empty.

For accessing translated messages through JS, the `getMessage` function
from the `i18n` file can be used.

For accessing messages from the background script, use the standard
`browser.i18n.getMessage` function instead. In this case, make sure
to add the uses message IDs to the `messages` list in `package.json`.
</details>

### UserChrome Translations

It is currently not possible to translate the UserChrome messages, but support
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Thanks to [all contributors](https://github.com/filips123/PWAsForFirefox/graphs/

### Other Mentions

Thanks to [all package maintainers](https://repology.org/project/firefoxpwa/information) making sure the project is up-to-date! Thanks to [all stargazers](https://github.com/filips123/PWAsForFirefox/stargazers) who starred our repository on GitHub. Finally, thanks to Mozilla and its developers for creating Firefox and making it possible to modify its UI using JavaScript!
Thanks to [all package maintainers](https://repology.org/project/firefoxpwa/information) making sure the project is up-to-date! Thanks to [all translators](https://crowdin.com/project/firefoxpwa) making the project available in multiple languages! Thanks to [all stargazers](https://github.com/filips123/PWAsForFirefox/stargazers) who starred our repository on GitHub. Finally, thanks to Mozilla and its developers for creating Firefox and making it possible to modify its UI using JavaScript!

## Versioning

Expand Down
3 changes: 2 additions & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ to this project for providing help and developing features!
<h3>Other Mentions</h3>

Thanks to [all package maintainers](https://repology.org/project/firefoxpwa/information)
making sure the project is up-to-date! Thanks to [all stargazers](https://github.com/filips123/PWAsForFirefox/stargazers)
making sure the project is up-to-date! Thanks to [all translators](https://crowdin.com/project/firefoxpwa)
making the project available in multiple languages! Thanks to [all stargazers](https://github.com/filips123/PWAsForFirefox/stargazers)
who starred our repository on GitHub. Finally, thanks to Mozilla and its developers for
creating Firefox and making it possible to modify its UI using JavaScript!

Expand Down
10 changes: 10 additions & 0 deletions docs/docs/user-guide/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ when a website has own "redirection" URLs that you do not want to open in a web
This option only has an effect when [automatic web app launching](#enable-automatic-web-app-launching)
is enabled.

### Language

The extension is translated into multiple languages. You can select which one you want to use.

!!! warning

Translations are maintained by the community and may be incomplete or incorrect.

You can help to improve them on [Crowdin](https://crowdin.com/project/firefoxpwa).

### Update web apps

This will download and parse manifests for all your web apps and register them again to
Expand Down

0 comments on commit 8b43df9

Please sign in to comment.