diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 43fafe476..1ed12492b 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -26,6 +26,7 @@ New features:: * core: evaluate option weechat.plugin.path, change default value to "${weechat_data_dir}/plugins" * core: add options to customize commands executed on system signals received (SIGHUP, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2) (issue #1595) * core: quit WeeChat by default when signal SIGHUP is received in normal run, reload configuration in weechat-headless (issue #1595) + * api: add translated string in evaluation of expressions with "translate:xxx" * api: add evaluation of WeeChat directories with "${weechat_xxx_dir}" in evaluated strings * api: add optional key "directory" in hashtable options of function/modifier string_eval_path_home * api: add supported prefixes "${weechat_xxx_dir}" in function mkdir_home diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 0092c57ad..74e1ebdbe 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -2758,6 +2758,12 @@ expanded to last): `+0.2+` + `+65536+` +| `+${translate:xxx}+` + + _(WeeChat ≥ 3.2)_ | + Translated string (depends on the language used by WeeChat to display messages). | + `+${translate:Plugin}+` | + `+Extension+` (example in French) + | `+${sec.data.name}+` | Value of the secured data `name`. | `+${sec.data.freenode_pass}+` | diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index a1fcf9e67..196f5a9c3 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -2804,6 +2804,13 @@ première étendue à la dernière) : `+0.2+` + `+65536+` +| `+${translate:xxx}+` + + _(WeeChat ≥ 3.2)_ | + Chaîne traduite (dépend de la langue utilisée par WeeChat pour afficher les + messages). | + `+${translate:Plugin}+` | + `+Extension+` (exemple en Français) + | `+${sec.data.nom}+` | Valeur de la donnée sécurisée `nom`. | `+${sec.data.freenode_pass}+` | diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 938d1bfcc..25b082a7d 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -2308,17 +2308,15 @@ str2 = weechat.string_input_for_buffer("/test") # "" str3 = weechat.string_input_for_buffer("//test") # "/test" ---- +// TRANSLATION MISSING ==== string_eval_expression -// TRANSLATION MISSING _WeeChat ≥ 0.4.0, updated in 0.4.2, 0.4.3, 1.0, 1.1, 1.2, 1.3, 1.6, 1.8, 2.0, 2.2, 2.3, 2.7, 2.9, 3.1 and 3.2._ -// TRANSLATION MISSING Evaluate an expression and return result as a string. Special variables with format `+${variable}+` are expanded (see table below). -// TRANSLATION MISSING [NOTE] Since version 1.0, nested variables are supported, for example: `+${color:${variable}}+`. @@ -2335,7 +2333,6 @@ char *weechat_string_eval_expression (const char *expr, Argomenti: -// TRANSLATION MISSING * _expr_: the expression to evaluate (see <> and <>) * _pointers_: hashtable with pointers (keys must be string, values must be @@ -2363,7 +2360,6 @@ Argomenti: ** _regex_replace_: the replacement text to use with _regex_, to replace text in _expr_ (the _regex_replace_ is evaluated on each match of _regex_ against _expr_, until no match is found) -// TRANSLATION MISSING ** _debug_: debug level (string with integer number ≥ 1), if enabled, a key "debug_output" is added in hashtable _options_: *** _1_: enable debug @@ -2371,7 +2367,6 @@ Argomenti: Valore restituito: -// TRANSLATION MISSING * evaluated expression (must be freed by calling "free" after use), or NULL if problem (invalid expression or not enough memory) @@ -2440,15 +2435,12 @@ options = { str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***" ---- -// TRANSLATION MISSING [[eval_conditions]] ===== Conditions -// TRANSLATION MISSING List of logical operators that can be used in conditions (by order of priority, from first used to last): -// TRANSLATION MISSING [width="100%",cols="2,8,4,4",options="header"] |=== | Operator | Description | Examples | Results @@ -2468,11 +2460,9 @@ from first used to last): `+0+` |=== -// TRANSLATION MISSING List of comparison operators that can be used in conditions (by order of priority, from first used to last): -// TRANSLATION MISSING [width="100%",cols="2,8,4,4",options="header"] |=== | Operator | Description | Examples | Results @@ -2614,7 +2604,6 @@ from first used to last): `+1+` |=== -// TRANSLATION MISSING The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats: @@ -2622,27 +2611,22 @@ valid numbers, with one of the following formats: * floating point number (examples: 5.2, -7.5, 2.83e-2) _(WeeChat ≥ 2.0)_ * hexadecimal number (examples: 0xA3, -0xA3) _(WeeChat ≥ 2.0)_ -// TRANSLATION MISSING To force a string comparison, you can add double quotes around each expression, for example: * `50 > 100` returns 0 (number comparison) * `"50" > "100"` returns 1 (string comparison) -// TRANSLATION MISSING [[eval_variables]] ===== Variables -// TRANSLATION MISSING List of variables expanded in expression (by order of priority, from first expanded to last): -// TRANSLATION MISSING [width="100%",cols="2,8,4,4",options="header"] |=== | Format | Description | Examples | Results -// TRANSLATION MISSING | `+${raw:xxx}+` + _(WeeChat ≥ 3.1)_ | Raw string (not evaluated). | @@ -2654,7 +2638,6 @@ expanded to last): `+${name}+` | `+value+` -// TRANSLATION MISSING | `+${weechat_xxx_dir}+` | A WeeChat directory: `+${weechat_config_dir}+`, `+${weechat_data_dir}+`, `+${weechat_cache_dir}+` or `+${weechat_runtime_dir}+`. | @@ -2801,7 +2784,6 @@ expanded to last): `+1.0+` + `+lightblue+` -// TRANSLATION MISSING | `+${base_encode:base,xxx}+` + _(WeeChat ≥ 2.9)_ | String encoded in base 16, 32 or 64. | @@ -2812,7 +2794,6 @@ expanded to last): `+ORSXG5BAON2HE2LOM4======+` + `+dGVzdCBzdHJpbmc=+` -// TRANSLATION MISSING | `+${base_decode:base,xxx}+` + _(WeeChat ≥ 2.9)_ | String decoded from base 16, 32 or 64. | @@ -2873,6 +2854,12 @@ expanded to last): `+0.2+` + `+65536+` +| `+${translate:xxx}+` + + _(WeeChat ≥ 3.2)_ | + Translated string (depends on the language used by WeeChat to display messages). | + `+${translate:Plugin}+` | + `+Extension+` (example in French) + | `+${sec.data.name}+` | Value of the secured data `name`. | `+${sec.data.freenode_pass}+` | diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index 02318faf1..a3d55d739 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -2796,6 +2796,13 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio `+0.2+` + `+65536+` +// TRANSLATION MISSING +| `+${translate:xxx}+` + + _(WeeChat ≥ 3.2)_ | + Translated string (depends on the language used by WeeChat to display messages). | + `+${translate:Plugin}+` | + `+Extension+` (example in French) + | `+${sec.data.name}+` | セキュアデータ `name` の値 | `+${sec.data.freenode_pass}+` | diff --git a/po/cs.po b/po/cs.po index b0377e946..62139a54d 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:49+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -1608,9 +1608,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1654,6 +1655,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/de.po b/po/de.po index e90fec648..89bcdb06a 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 23:44+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -1676,6 +1676,7 @@ msgstr "" "[-n|-s] [-d] || [-n] [-d [-d]] -c " "" +#, fuzzy msgid "" " -n: display result without sending it to buffer (debug mode)\n" " -s: split expression before evaluating it (many commands can be " @@ -1750,9 +1751,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1796,6 +1798,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/es.po b/po/es.po index 28112d908..6631c0560 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -1637,9 +1637,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1683,6 +1684,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/fr.po b/po/fr.po index 2f543882b..e5ae5bd8e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" -"PO-Revision-Date: 2021-05-16 08:36+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" +"PO-Revision-Date: 2021-05-16 09:47+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -1723,9 +1723,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1769,6 +1770,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" @@ -1860,9 +1862,10 @@ msgstr "" "valeur_si_faux\")\n" " 17. le résultat d'une expression avec parenthèses et les opérateurs + - " "* / // % ** (format: \"calc:xxx\")\n" -" 18. une option (format : \"fichier.section.option\")\n" -" 19. une variable locale du tampon\n" -" 20. un hdata/variable (la valeur est automatiquement convertie en chaîne), " +" 18. une chaîne traduite (format : \"translate:xxx\")\n" +" 19. une option (format : \"fichier.section.option\")\n" +" 20. une variable locale du tampon\n" +" 21. un hdata/variable (la valeur est automatiquement convertie en chaîne), " "par défaut \"window\" et \"buffer\" pointent vers la fenêtre et le tampon " "courants.\n" "Le format du hdata peut être le suivant :\n" @@ -1907,6 +1910,7 @@ msgstr "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Exemples (conditions) :\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/hu.po b/po/hu.po index 5136be405..121cd085d 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1524,9 +1524,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1570,6 +1571,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/it.po b/po/it.po index bfb47b5a2..48ed7480d 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -1620,9 +1620,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1666,6 +1667,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/ja.po b/po/ja.po index 42100c73a..084767d3d 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/pl.po b/po/pl.po index f621fb12a..5d2419689 100644 --- a/po/pl.po +++ b/po/pl.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: Polish \n" @@ -1718,9 +1718,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1764,6 +1765,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/pt.po b/po/pt.po index 6e42107be..c5ed80b1c 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -1679,9 +1679,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1725,6 +1726,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 95d5491f7..1bdb30644 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -1683,9 +1683,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1729,6 +1730,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/ru.po b/po/ru.po index 98b008aa2..45cb7a18a 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -1546,9 +1546,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1592,6 +1593,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/tr.po b/po/tr.po index c3c1534f1..5852cbb16 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2021-05-15 16:50+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -1379,9 +1379,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1425,6 +1426,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/po/weechat.pot b/po/weechat.pot index 7cd98b5b9..9b1a15b5f 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2021-05-16 08:35+0200\n" +"POT-Creation-Date: 2021-05-16 09:47+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -1381,9 +1381,10 @@ msgid "" "\")\n" " 17. result of an expression with parentheses and operators + - * / // % ** " "(format: \"calc:xxx\")\n" -" 18. an option (format: \"file.section.option\")\n" -" 19. a local variable in buffer\n" -" 20. a hdata name/variable (the value is automatically converted to " +" 18. a translated string (format: \"translate:xxx\")\n" +" 19. an option (format: \"file.section.option\")\n" +" 20. a local variable in buffer\n" +" 21. a hdata name/variable (the value is automatically converted to " "string), by default \"window\" and \"buffer\" point to current window/" "buffer.\n" "Format for hdata can be one of following:\n" @@ -1427,6 +1428,7 @@ msgid "" " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" +" /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index fb1778996..cf942f510 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -7571,9 +7571,10 @@ command_init () "\"if:condition?value_if_true:value_if_false\")\n" " 17. result of an expression with parentheses and operators " "+ - * / // % ** (format: \"calc:xxx\")\n" - " 18. an option (format: \"file.section.option\")\n" - " 19. a local variable in buffer\n" - " 20. a hdata name/variable (the value is automatically converted " + " 18. a translated string (format: \"translate:xxx\")\n" + " 19. an option (format: \"file.section.option\")\n" + " 20. a local variable in buffer\n" + " 21. a hdata name/variable (the value is automatically converted " "to string), by default \"window\" and \"buffer\" point to current " "window/buffer.\n" "Format for hdata can be one of following:\n" @@ -7617,6 +7618,7 @@ command_init () " /eval -n ${calc:(5+2)*3} ==> 21\n" " /eval -n ${base_encode:64,test} ==> dGVzdA==\n" " /eval -n ${base_decode:64,dGVzdA==} ==> test\n" + " /eval -n ${translate:Plugin} ==> Extension\n" "\n" "Examples (conditions):\n" " /eval -n -c ${window.buffer.number} > 2 ==> 0\n" diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index c8f82d890..52c43d9e0 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -725,6 +725,25 @@ eval_string_if (const char *text, struct t_eval_context *eval_context) return (value) ? value : strdup (""); } +/* + * Translates text. + * + * Note: result must be freed after use. + */ + +char * +eval_translate (const char *text) +{ + const char *ptr_string; + + if (!text || !text[0]) + return strdup (""); + + ptr_string = gettext (text); + + return strdup ((ptr_string) ? ptr_string : ""); +} + /* * Gets value of hdata using "path" to a variable. * @@ -1034,10 +1053,11 @@ end: * 18. an environment variable (format: env:XXX) * 19. a ternary operator (format: if:condition?value_if_true:value_if_false) * 20. calculate result of an expression (format: calc:xxx) - * 21. an option (format: file.section.option) - * 22. a buffer local variable - * 23. a pointer name from hashtable "pointers" - * 24. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2 + * 21. a translated string (format: translate:xxx) + * 22. an option (format: file.section.option) + * 23. a buffer local variable + * 24. a pointer name from hashtable "pointers" + * 25. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2 * or hdata[ptr].var1.var2 or hdata[ptr_name].var1.var2) * * See /help in WeeChat for examples. @@ -1285,7 +1305,16 @@ eval_replace_vars_cb (void *data, const char *text) goto end; } - /* 21. option: if found, return this value */ + /* + * 21. translated text + */ + if (strncmp (text, "translate:", 10) == 0) + { + value = eval_translate (text + 10); + goto end; + } + + /* 22. option: if found, return this value */ if (strncmp (text, "sec.data.", 9) == 0) { ptr_value = hashtable_get (secure_hashtable_data, text + 9); @@ -1328,7 +1357,7 @@ eval_replace_vars_cb (void *data, const char *text) } } - /* 22. local variable in buffer */ + /* 23. local variable in buffer */ ptr_buffer = hashtable_get (eval_context->pointers, "buffer"); if (ptr_buffer) { @@ -1340,7 +1369,7 @@ eval_replace_vars_cb (void *data, const char *text) } } - /* 23. hdata */ + /* 24. hdata */ value = eval_string_hdata (text, eval_context); end: