]> jfr.im git - irc/weechat/weechat.git/commitdiff
api: add translated string in evaluation of expressions with "translate:xxx" (issue...
authorSébastien Helleu <redacted>
Sun, 16 May 2021 07:49:09 +0000 (09:49 +0200)
committerSébastien Helleu <redacted>
Sun, 16 May 2021 08:01:03 +0000 (10:01 +0200)
20 files changed:
ChangeLog.adoc
doc/en/weechat_plugin_api.en.adoc
doc/fr/weechat_plugin_api.fr.adoc
doc/it/weechat_plugin_api.it.adoc
doc/ja/weechat_plugin_api.ja.adoc
po/cs.po
po/de.po
po/es.po
po/fr.po
po/hu.po
po/it.po
po/ja.po
po/pl.po
po/pt.po
po/pt_BR.po
po/ru.po
po/tr.po
po/weechat.pot
src/core/wee-command.c
src/core/wee-eval.c

index 43fafe4764bb07f26551168f89d5c6becd03ee97..1ed12492bfe1bcdff7e8e728b178988272e6c4bc 100644 (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
index 0092c57ada88e87156a1fd610f44c917354a3061..74e1ebdbe4518472219f8a9dfe357700f724b5ae 100644 (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}+` |
index a1fcf9e67d984fc1b0f212bea7d7df4a80b1ae51..196f5a9c333d2f56c93a03085ede845c9b9347ff 100644 (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}+` |
index 938d1bfcc30625d9d3d8c7fd971fb6d43d0ca48d..25b082a7da491a1a8abf78168bbc5b2fa7c3ab02 100644 (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}+` |
index 02318faf1afa674cee51b20fb37cc2a385bb037d..a3d55d73975418d356558cee7466896b8e3a8f1f 100644 (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}+` |
index b0377e946c1829e9a7c25cc3493a3be02ede9a1b..62139a54d9a6e933d08c5904ebd271b11e48caf4 100644 (file)
--- 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 <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"
index e90fec648ec1e5dbebb46a52bc7632a81326dd9e..89bcdb06abe3aed14588061229654f6e13007db7 100644 (file)
--- 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 <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"
index 28112d908f63e26b37e6c60420d4a31db1358d77..6631c0560e55ffb7c21c66caf93d6ea8914e4525 100644 (file)
--- 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 <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"
index 2f543882b84033fb79c0fecd8f16d68b5462cff6..e5ae5bd8e711313a3cf79ae533cf27aea7a56111 100644 (file)
--- 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 <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"
index 5136be405809fe1e2049797ddb82969ff2e0a33f..121cd085d572fecc5777b8622af6a8be051dfedb 100644 (file)
--- 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 <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"
index bfb47b5a252c94bbbe3407f3466323ca1c073c6b..48ed7480d570edc4bcb7c6f39dcc416cc960ecaf 100644 (file)
--- 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 <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"
index 42100c73afcf02c0f71b601d3ae13fd169dca316..084767d3dcb1c0c62f70a10104d9f5fc9ad536ef 100644 (file)
--- 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 <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"
index f621fb12a8de5ec2309a8538c8f0fd8b4fbf6dfb..5d24196898578de2173be1e58934542fa1f758fc 100644 (file)
--- 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 <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"
index 6e42107bee393fe388d47617aac7062a1ba7b13c..c5ed80b1cd765e7dd66f6e9d4410a4a151cf8e03 100644 (file)
--- 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 <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"
index 95d5491f73c202b6f1b60f2871850dfb40c573b2..1bdb30644c08779d061dcb337ca38badbe51923b 100644 (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"
index 98b008aa2be367450718cd8b10a7be417f2db5e9..45cb7a18ae5bc669cb79935f2fd9bf9df5b19f73 100644 (file)
--- 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 <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"
index c3c1534f1808c0c0ae5213197399c88d5173886b..5852cbb16c4d5f3bf2c9a62418943789523a5d59 100644 (file)
--- 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 <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"
index 7cd98b5b9107b9d0d9ec42e80f3071185b04a8c5..9b1a15b5fb1b8bf61bb235fbe1646883e753077e 100644 (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"
index fb177899640e726c20682cae565fbced3d7be98d..cf942f510ead1a912b1d6534a8bd35a4e0057958 100644 (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"
index c8f82d8904c254b423e2963a9dd7a07412c6b404..52c43d9e01c61cd9c66e2d6232e4c7d76c458124 100644 (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: