syeopite / lens Goto Github PK
View Code? Open in Web Editor NEWA multiformat internationalization (i18n) shard for Crystal.
License: MIT License
A multiformat internationalization (i18n) shard for Crystal.
License: MIT License
I18next is another popular standard translation format. It's features includes:
So, I think it's a good candidate for next major backend Lens implements. Perhaps in 0.2?
In Lens, each of the backends currently have a slightly different behavior.
For instance, the Gettext family of backends returns the given ID when a translation is not found.
backend = Gettext::MOBackend.new("locales")
catalogue_hash = backend.create()
catalogue = catalogue_hash["en_US"]
catalogue.gettext("I don't exist") # => "I don't exist"
Whereas the RubyI18n YAML backend would raise an LensExceptions::MissingTranslation
catalogue = RubyI18n::Yaml.new("locales")
catalogue.translate("en", "I also don't exist") # => LensExceptions::MissingTranslation
Not to mention the fact that Gettext requires creating a catalogue object first while the other doesn't.
This discrepancy is intentional, in order to preserve the behaviors seen in their reference or intended implementations.
However, I do see merit in a potential way to configure these behaviors. It wouldn't change the API differences, but it would help resolve any unintended errors a developer might experience when swapping backends.
The basic infrastructure for implementing number formatting was introduced in Lens with commit 5997047. Since then, almost all features needed to format a number has been added. In fact, the formatter is actually present and working:
In commit 7e2d9f1 of master, this code produces the expected output of 10,00,00,000.124
rules, metadata = CLDR::Numbers::PatternParser.new("#,##0.##").parse
formatter = CLDR::Numbers::PatternFormatter(CLDR::Languages::EN).new(rules, metadata)
formatter.format(1000.129) # => 1,000.13
formatter.format(-1000.129) # => -1,000.13
However, despite all this there's still quite a few crucial features missing.
A better public API should then be constructed before we can push it out to version 0.2.
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.