mwmbl / crawler-extension

A browser extension that can be installed by volunteers to participate in mwmbl distributed crawling.
GNU Affero General Public License v3.0
21 stars 2 forks source link

Internationalization #30

Closed adjagu closed 2 years ago

adjagu commented 2 years ago

Added internationalization.

With this others will be able to translate the extension into languages other than English.

To add a new translation a person would do the following:

  1. Add folder for new language in the _locales directory
    • Example: de for German, fr_FR for French
  2. Copy _locales/en/messages.json to the directory created in step 1
    • Translate the "description" and "message" sections into the desired language
ColinEspinas commented 2 years ago

Looks good indeed.

Using the standard implementation is great. I just don't like the format they use (__MSG_ + messageName + __) but we can't do anything about it.

I just would want to discuss about the way you name the messages. Wouldn't something like <scope>.<message> be better?

Example:

"manifest.name": {
    "description": "Web-extension name in the manifest file.",
    "message": "MWMBL Web Crawler"
},
"popup.logs.successMessage": {
    "description": "Success message shown in the log page.",
    "message": "$URL$ as been successfully crawled"
    "placeholders": {
        "url" : {
            "content" : "$1",
            "example" : "https://mwmbl.org"
        }
    }
},

This can be used to add context to translated keys.

ColinEspinas commented 2 years ago

Thanks for the contribution, great work!