From 47a5b2c84ba97df0a86b00599b9c34053a681e41 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Fri, 21 Dec 2018 21:04:36 -0800 Subject: [PATCH 1/3] override translation strings using data attributes --- docs/docs/configuration/client.rst | 10 +++++++++- isso/js/app/i18n.js | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/docs/configuration/client.rst b/docs/docs/configuration/client.rst index 2ba48df..e79c1cb 100644 --- a/docs/docs/configuration/client.rst +++ b/docs/docs/configuration/client.rst @@ -31,6 +31,14 @@ the embed tag, as well as the thread ID, e.g.:
+Additionally, you can override any translation string for any language by adding +a `data-isso-` attribute that is equal to the translation key (found `here`__) with +`-text-[lang]` appended to it. So, for example, if you want to override the +english translation of the `postbox-notification` message, you could add +`data-isso-postbox-notification-lang-en="Select to be notified of replies to your comment"` + +.. __: https://github.com/posativ/isso/blob/master/isso/js/app/i18n/en.js + data-isso --------- @@ -116,7 +124,7 @@ and not a multiple of 2, the color distribution is not even. data-isso-gravatar ------------------ -Uses gravatar images instead of generating svg images. You have to set +Uses gravatar images instead of generating svg images. You have to set "data-isso-avatar" to **false** when you want to use this. Otherwise both the gravatar and avatar svg image will show up. Please also set option "gravatar" to **true** in the server configuration... diff --git a/isso/js/app/i18n.js b/isso/js/app/i18n.js index 9f44b5b..289c265 100644 --- a/isso/js/app/i18n.js +++ b/isso/js/app/i18n.js @@ -85,7 +85,10 @@ define(["app/config", "app/i18n/bg", "app/i18n/cs", "app/i18n/da", var plural = pluralforms(lang); var translate = function(msgid) { - return catalogue[lang][msgid] || en[msgid] || "???"; + return config[msgid + '-text-' + lang] || + catalogue[lang][msgid] || + en[msgid] || + "???"; }; var pluralize = function(msgid, n) { From 423d73664bcb5292ca0718c8777cb54af6542902 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Fri, 21 Dec 2018 21:09:26 -0800 Subject: [PATCH 2/3] fix typo in translation override docs --- docs/docs/configuration/client.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/configuration/client.rst b/docs/docs/configuration/client.rst index e79c1cb..5a49c7b 100644 --- a/docs/docs/configuration/client.rst +++ b/docs/docs/configuration/client.rst @@ -35,7 +35,7 @@ Additionally, you can override any translation string for any language by adding a `data-isso-` attribute that is equal to the translation key (found `here`__) with `-text-[lang]` appended to it. So, for example, if you want to override the english translation of the `postbox-notification` message, you could add -`data-isso-postbox-notification-lang-en="Select to be notified of replies to your comment"` +`data-isso-postbox-notification-text-en="Select to be notified of replies to your comment"` .. __: https://github.com/posativ/isso/blob/master/isso/js/app/i18n/en.js From ebefbe6a4a9742db672fe6dddab20534bbf95864 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Fri, 21 Dec 2018 21:12:27 -0800 Subject: [PATCH 3/3] fix inline code highlighting --- docs/docs/configuration/client.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/docs/configuration/client.rst b/docs/docs/configuration/client.rst index 5a49c7b..34d9b47 100644 --- a/docs/docs/configuration/client.rst +++ b/docs/docs/configuration/client.rst @@ -32,10 +32,11 @@ the embed tag, as well as the thread ID, e.g.:
Additionally, you can override any translation string for any language by adding -a `data-isso-` attribute that is equal to the translation key (found `here`__) with -`-text-[lang]` appended to it. So, for example, if you want to override the -english translation of the `postbox-notification` message, you could add -`data-isso-postbox-notification-text-en="Select to be notified of replies to your comment"` +a ``data-isso-`` attribute that is equal to the translation key (found `here`__) with +``-text-[lang]`` appended to it. So, for example, if you want to override the +english translation of the ``postbox-notification`` message, you could add: + +``data-isso-postbox-notification-text-en="Select to be notified of replies to your comment"`` .. __: https://github.com/posativ/isso/blob/master/isso/js/app/i18n/en.js