From 5ef8b91db832c9aeb2adcb5014f3cf6aedf44157 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Fri, 2 Jun 2017 20:40:58 -0700 Subject: [PATCH] fix three explicitly translated messages --- CONTRIBUTING.md | 18 +++++++++++++++++- share/completions/set.fish | 2 +- .../functions/__fish_complete_directories.fish | 2 +- share/functions/__fish_print_packages.fish | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a14ba1268..3a1affa27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -250,7 +250,23 @@ sudo ln -s /usr/bin/clang-format-3.9 /usr/bin/clang-format ## Message Translations -Fish uses the GNU gettext library to translate messages from english to other languages. To create or update a translation run `make po/[LANGUAGE CODE].po`. Where `LANGUAGE CODE` is the two letter ISO 639-1 language code of the language you are translating to. For example, `de` for German. You'll need to have the `xgettext` and `msgmerge` commands installed to do this. +Fish uses the GNU gettext library to translate messages from english to other languages. To create or update a translation run `make po/[LANGUAGE CODE].po`. Where `LANGUAGE CODE` is the two letter ISO 639-1 language code of the language you are translating to. For example, `de` for German. You'll need to have the `xgettext`, `msgfmt` and `msgmerge` commands installed to do this. + +All messages in fish script must be enclosed in single or double quote characters. They must also be translated via a subcommand. This means that the following are not valid: + +``` +echo (_ hello) +_ "goodbye" +``` + +Those should be written like this: + +``` +echo (_ "hello") +echo (_ "goodbye") +``` + +Note that you can use either single or double quotes to enclose the message to be translated. You can also optionally include spaces after the opening parentheses and before the closing paren. Be cautious about blindly updating an existing translation file. Trivial changes to an existing message (e.g., changing the punctuation) will cause existing translations to be removed. That is because the tools do literal string matching. Which means that in general you need to carefully review any recommended deletions. diff --git a/share/completions/set.fish b/share/completions/set.fish index 4184d297d..7f27693bd 100644 --- a/share/completions/set.fish +++ b/share/completions/set.fish @@ -76,5 +76,5 @@ complete -c set -n '__fish_set_is_color' -s o -l bold --description 'Make font b # Locale completions complete -c set -n '__fish_is_first_token' -x -a '$__fish_locale_vars' -d 'Locale variable' -complete -c set -n '__fish_set_is_locale' -x -a '(locale -a)' -d (_ Locale) +complete -c set -n '__fish_set_is_locale' -x -a '(locale -a)' -d (_ "Locale") complete -c set -s L -l long -d 'Do not truncate long lines' diff --git a/share/functions/__fish_complete_directories.fish b/share/functions/__fish_complete_directories.fish index 158f0eb1b..9de6ac67e 100644 --- a/share/functions/__fish_complete_directories.fish +++ b/share/functions/__fish_complete_directories.fish @@ -4,7 +4,7 @@ # function __fish_complete_directories -d "Complete directory prefixes" --argument comp desc if not set -q desc[1] - set desc (_ Directory) + set desc (_ "Directory") end set -l dirs $comp*/ diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish index 210884a5e..6809039fb 100644 --- a/share/functions/__fish_print_packages.fish +++ b/share/functions/__fish_print_packages.fish @@ -10,7 +10,7 @@ function __fish_print_packages end #Get the word 'Package' in the current language - set -l package (_ Package) + set -l package (_ "Package") # Set up cache directory if test -z "$XDG_CACHE_HOME"