Skip to content

Internationalization i18n (Developer Guide)

escapedcat edited this page May 24, 2022 · 3 revisions

Introduction

Alby is a general browser extension to bring the Bitcoin Lightning network to the browser. Alby extension provides deep Lightning Network integration for websites (for payments and authentication flows) and allows browsers to interact with the Lightning Network programmatically. The Alby extension implements the WebLN standard as the interface that allows websites to connect to Lightning Network nodes (to request payments, invoices, signatures, login, etc.) and enable seamless UX of web payments and authentications.

Internationalization, also abbreviated as I18n, is a process of abstracting the strings out of the application in form of keyed dictionaries (we use .json file format) and having their translations in the desired language so that the platform can be represented in multiple languages.

The internationalization and localization of Alby aim at creating a flexible I18n infrastructure in such a way that creating, editing, modifying, and managing translations in Alby can be done an easier way.

Overview

Add translations

Alby uses Weblate to manage translations for different locales. If you'd like to contribute, you can add translations here.

I18n library used

We use the react-i18next library which is shipped with different helper plugins. It is an easy to use and extensible library for translating React-based platforms into multiple languages.

Along with this, we use the integration of a browser language detector plugin for automated language detection, locale load and locale store throughout the different sessions.

Translation Directory

All the translations are placed in src/i18n/locales/{locale}/, where {locale} is the locale name representation of the language (e.g. en/ for English, hi/ for Hindi). Each {locale} folder contains two files:

  • translation.json: Strings that should be treated as unique to where they are used (even if it happens to be a duplicate)
  • common.json: Repeated strings used frequently throughout the app

Locale names are standard acronyms defined for each language according to the ISO 639-1 standards. You can visit a curated list of locales along with their language names, Here

Clone this wiki locally