sgissinger / eleventy-plugin-i18n-gettext Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
If the key
is passed using a variable, the variable isn't resolved and the entire call is not added to messages.js. It will still resolve to the correct localization if the po files are updated properly.
{% set example = "Hello World!" %}
{{ _(example) }}
The resulting message.js will not include _(example)
nor _("Hello World!")
.
A workaround is to force inclusion of the resolved term by including it in some other part. Possibly in something that isn't actually used to render. That is explicitly calling _("Hello World!")
somewhere or perhaps i18n._(locale, "Hello World!")
in an unused portion of a _data
file or etc.
When making calls in JavaScript such as i18n._("en-CA", "To Translate")
messages.js is populated with `_("en-CA") instead.
A workaround is to ensure that you have a variable called locale
that is passed in as the first argument. e.g.
let locale = "en-CA";
i18n._(locale, "To Translate");
For example, a partial containing the following meta data:
<meta property="og:locale" content="{{ lang | replace("-", "_") }}">
The message.js contains "_) }}"
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.