Lokyr
Documentation

Translating Lokyr

On this page

Lokyr speaks English and Italian, and every other language is welcome. This guide tells what there is to translate, how to improve a translation that exists, and how to add a language. You need no Rust to translate: a text editor and a Mac to try the result on are enough, and a pull request takes your files the rest of the way. CONTRIBUTING.md tells how to set up the project and what a pull request needs.

What there is to translate

Every text that Lokyr shows you: its menus, the titles of its commands, its alerts and notices, the line of a window whose program ended, the find bar and the tab bar, and the prompts that macOS shows when a program in the terminal asks for the camera, the microphone or a folder. The texts are in Project Fluent catalogs, .ftl files, a set for each language; English is the source, which every other language follows.

Some texts stay in English: the log, which reports of problems quote; the sleip command line; the documentation; and the config's keys and values, which are the same in every language.

The catalogs, each in a folder of its language's code, en for English, it for Italian:

CatalogIts texts
crates/app-core/resources/locales/en/app.ftlThe menus, the app's commands, its alerts and notices
crates/app-core/resources/locales/en/infoplist.ftlWhat macOS shows as a program in the terminal asks for the camera, the contacts and the like
crates/kernel/locales/en/kernel.ftlThe line of a window whose program ended, or could not start
plugins/core-actions/locales/en/core-actions.ftlCopy, paste, scrolling and the text's size
plugins/links/locales/en/links.ftlOpening links
plugins/tabs/locales/en/tabs.ftlThe tab bar and its commands
plugins/splits/locales/en/splits.ftlThe panes' commands
plugins/search/locales/en/search.ftlThe find bar
plugins/command-palette/locales/en/command-palette.ftlThe command palette
plugins/quick-terminal/locales/en/quick-terminal.ftlThe quick terminal
plugins/progress/locales/en/progress.ftlThe programs' progress
plugins/command-header/locales/en/command-header.ftlThe command at a pane's top
plugins/blocks/locales/en/blocks.ftlThe commands' blocks: the command at a pane's top, and its arrow to the block's end
plugins/copy-mode/locales/en/copy-mode.ftlThe copy mode
plugins/quick-tips/locales/en/quick-tips.ftlThe quick tips

The keymap-macos plugin has no texts of its own.

The format

A catalog is a list of messages, each an identifier, =, and its text. A line that starts with # is a comment for you, which tells where the texts show:

# The find bar: its field's placeholder, and the count of the matches.
find-placeholder = Find
find-count = { $current } of { $count }

Style

Improving a translation

Edit the catalog of your language, as crates/app-core/resources/locales/it/app.ftl, and open a pull request with what you changed and why. The tests check that each catalog has every message of English's, and no other, each with English's variables: cargo test -p lokyr-kernel l10n and cargo test -p lokyr-app-core catalogs run them, and so does just ci.

When English gains a message, every other catalog needs it too, or the tests fail: whoever adds a text to English adds it to the other languages, as well as they can, and a speaker of the language makes it right later.

Adding a language

Lokyr takes languages by their two- or three-letter code alone, as fr, de or ja, without a region: a system set to French of Canada reads fr. A language that needs two variants, as Portuguese of Brazil and of Portugal, is not possible yet; open an issue first.

  1. Make it. One command makes your language ready to translate, of its code, as fr:

    just new-language fr
    

    It copies every English catalog, each locales/en folder of the table above, to one of your language's code, and adds your language to each list of catalogs that Lokyr builds into its binary and to the configuration guide's language key. infoplist.ftl needs nothing more: building the app finds every language's folder. Without just, cargo xtask new-language fr does the same.

  2. Translate the files of your language's folders, as the format and the style above tell.

  3. Check it, as you go and before your pull request:

    just check-language fr
    

    It tells each catalog's messages that are missing, those that English has not, those whose variables are not English's, and those still as English has them; the first three fail it, which the tests fail too. A message can stay as English has it where your language says it so, as a name: the check tells it, and nothing fails.

  4. Run the tests, cargo test -p lokyr-kernel l10n and cargo test -p lokyr-app-core catalogs, or just ci, which check every language's catalogs against English's.

  5. Try it. Set the language in your config, which applies as you save it, the menus too:

    [app]
    language = "fr"
    

    Then go through the app: the menus, the alerts, as a paste of several lines or quitting with a program running, the tab bar's tooltips and its context menu, the find bar, and a window whose program ended. just bundle builds target/Lokyr.app, whose prompts of macOS, as a program's ask for the camera, follow the system's language rather than the config's.

  6. Open the pull request, with just ci green, and tell in it how you tried it, as CONTRIBUTING.md asks of checks by hand. A screenshot or two of the menus and the find bar help the review.

Thank you: every language makes Lokyr someone's own terminal.