api: add translated string in evaluation of expressions with "translate:xxx" (issue #1622)

This commit is contained in:
Sébastien Helleu 2021-05-16 09:49:09 +02:00
parent 7e10038f4b
commit 5bce484c01
20 changed files with 154 additions and 86 deletions

View File

@ -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

View File

@ -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}+` |

View File

@ -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}+` |

View File

@ -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 <<eval_conditions,conditions>> and
<<eval_variables,variables>>)
* _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}+` |

View File

@ -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}+` |

View File

@ -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 <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -1676,6 +1676,7 @@ msgstr ""
"[-n|-s] [-d] <expression> || [-n] [-d [-d]] -c <expression1> <operator> "
"<expression2>"
#, 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"

View File

@ -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 <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -1676,9 +1676,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"
@ -1722,6 +1723,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"

View File

@ -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 <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\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"

View File

@ -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 <vascomalmeida@sapo.pt>\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"

View File

@ -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 <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"

View File

@ -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"

View File

@ -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: