mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 03:51:14 -03:00
Use LocalizableString for gettext
This new wrapper type can be constructed via macros which invoke the `gettext_extract` proc macro to extract the string literals for PO file generation. The type checking enabled by this wrapper should prevent trying to obtain translations for a string for which none exist. Because some strings (e.g. for completions) are not defined in Rust, but rather in fish scripts, the `LocalizableString` type can also be constructed from non-literals, in which case no extraction happens. In such cases, it is the programmer's responsibility to only construct the type for strings which are available for localization. This approach is a replacement for the `cargo-expand`-based extraction. When building with the `FISH_GETTEXT_EXTRACTION_FILE` environment variable set, the `gettext_extract` proc macro will write the messages marked for extraction to a file in the directory specified by the variable. Updates to the po files: - This is the result of running the `update_translations.fish` script using the new proc_macro extraction. It finds additional messages compared to the `cargo-expand` based approach. - Messages IDs corresponding to paths are removed. The do not have localizations in any language and localizing paths would not make sense. I have not investigated how they made it into the po files in the first place. - Some messages are reordered due to `msguniq` sorting differing from `sort`. Remove docs about installing `cargo-expand` These are no longer needed due to the switch to our extraction macro.
This commit is contained in:
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
@@ -32,11 +32,8 @@ jobs:
|
||||
- name: make fish_run_tests
|
||||
run: |
|
||||
make -C build VERBOSE=1 fish_run_tests
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: translation updates
|
||||
run: |
|
||||
# Required for our custom xgettext implementation.
|
||||
cargo install --locked --version 1.0.106 cargo-expand
|
||||
# Generate PO files. This should not result it a change in the repo if all translations are
|
||||
# up to date.
|
||||
# Ensure that fish is available as an executable.
|
||||
|
||||
Reference in New Issue
Block a user