vphantom / gettext-pythonic Goto Github PK
View Code? Open in Web Editor NEWTiny po2json-compatible gettext with variable substitution
License: MIT License
Tiny po2json-compatible gettext with variable substitution
License: MIT License
Implement ngettext()
a.k.a. n_()
as a plural front-end to the single-string function (if that's indeed how we look up plurals in the result of po2json
). This means understanding how po2json
saved the plural function in the first place...
Let's create v0.5.0 for the cleaned up singular-only version before the big plural refactor.
The shortcut module || this
chokes on module not existing in browsers, so gettext-pythonic only works server-side right now. ๐ฆ
To avoid conflict with other frameworks and interoperate with other options like Jed, let's expose gettext()
and __()
as its alias (to leave _()
alone, unfortunately).
The thing's tiny, insanely tiny, but we still want to maintain it and access it through standard channels. Actually depends on #2 (whoops, should've created that one first!)
Recognize %{key}
instead of {key}
as a placeholder for substitution. This will make it more obvious to translators, as classic substitutions were printf-based.
Hello! if i translate my phrase without variable then all fine but else script cant find my phrase in json file. For example:
__('Hello, %{name}', {
name: 'Alex'
});
But in json dictionary phrase == Hello, %s. And script cant find Hello, %{name}
in dictionary and return me phrase without translate
We can't really publish on NPM without a basic test suite. This means:
eslint
tape
+faucet
istanbul
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.