tinywebex / localizer Goto Github PK
View Code? Open in Web Editor NEWA tiny library that translates your HTML file with the WebExtension translation system.
Home Page: https://tinywebex.github.io/Localizer/
License: MIT License
A tiny library that translates your HTML file with the WebExtension translation system.
Home Page: https://tinywebex.github.io/Localizer/
License: MIT License
HTML template elements are not localized as expected:
<template>
<span data-i18n="__MSG_example__">Please translate me!</span>
</template>
The issue is that they are not found by document.querySelectorAll
:
Lines 283 to 286 in f6da4ca
This affects my Thunderbird Send add-on, which uses an HTML template element in the popup. See tdulcet/Thunderbird-Send#14.
CC: @DenB10
Hi! First of all, hats off to this module, it makes dynamic translation of extension HTML messages very efficient and flexible. ๐ We are using it in this extension and it works like a charm.
I was wondering whether the __MSG_*__
format in message ids really adds anything. I know it's necessary for text replacement in the manifest.json
and CSS files, but with data-i18n*
attributes explicitly and only referring to message ids, the format can be entirely avoided, thus avoiding a lot of noise in the HTML file. As you can see, we altered Localizer to remove that requirement and it works perfectly, even with predefined messages like @@ui_locale
.
For backwards compatibility, getMessageTag
may remove the __MSG_*__
wrapper if present as it does now, otherwise just use the tag as is. If you like the idea I can provide a PR, but my JS abilities are very limited.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.