l20n

Localize an attribute with l20n

元气小坏坏 提交于 2020-01-24 02:54:07
问题 I'd like to localize a placeholder attribute with L20N. I can't find anything in their documentation, and doing this (unsurprisingly) doesn't work. <input type="text" data-l10n-id="email" /> 回答1: A normal translation (meaning you want to replace the content) is written like this: <test "this is a translated text"> You can then translate attributes like this: <test "this is a translated text" title:"this is the title"> In your case, you only want the attribute, so this will work: <test

Tutorial: solution for node.js / Polymer i18n based on L20n library

荒凉一梦 提交于 2019-12-20 07:04:16
问题 There is a rather usual problem to implement i18n in node.js web project. The problem seems even worse if you want to: use web components (like Polymer) use single translation file for server-side and client-side files translate some items programmaticaly (like dynamically created strings) Thanks to brand-new L20n library developed by Mozilla team this problem can be solved rather easily. 回答1: Project structure First I created a project structure, that would keep my files separatedly, grouped

l20n with HTML markup?

与世无争的帅哥 提交于 2019-12-05 15:58:42
How would I use l20n if I wanted to create something like this: About <strong>Firefox</strong> I want to translate the phrase as a whole but I also want the markup. I don't want to have to do this: <aboutBrowser "About {{ browserBrandShortName }}"> <aboutBrowserStrong "About <strong>{{ browserBrandShortName }}</strong>"> ...as the translation itself is now duplicated. I understand that this might not be in the scope of l20n, but it is probably a common enough case in the real world. Is there some kind of established way to go about this? Sometimes duplicating the translation is the best thing