tkadauke / motion-i18n Goto Github PK
View Code? Open in Web Editor NEWWrapper for translations in RubyMotion
Wrapper for translations in RubyMotion
My locale yml file contains something similar to this:
en:
hello_world: say "hello"
As far as I know, this is valid YAML. However, when the Localizable.strings
file gets created, it looks like this:
"hello_world" = "say "hello"";
...resulting in a syntax error. I think this gem needs to escape double quotes.
Hello,
Is it possible to translate month names and type day names?
Thoughts on outputting a debug message in the REPL when a translated string doesn't exist?
something like
> I18n.t(:some_key_that_doesnt_exist)
> WARNING! I18n key doesn't exist for: :some_key_that_doesnt_exist.
> Please add it to your translation file.
and then do some symbol to string conversion for the time being so that the app doesn't crash? Maybe something like:
# Convert using: key.to_s.gsub(/_/, ' ')
I18n.t(:some_key_that_doesnt_exist) # some key that doesn't exist
Followed the instructions and it's telling me that all my translations are not used when they, in fact, are.
rake translations:unused
Shows all strings :(
When I run my app after incorporating this gem, I get the following:
$ rake --trace ** Invoke default (first_time)
** Execute default
******************************************
Build for development environment...
******************************************
** Invoke default (first_time)
** Invoke simulator (first_time)
** Execute simulator
** Invoke build:simulator (first_time)
** Invoke translate (first_time)
** Execute translate
rake aborted!
NoMethodError: undefined method `each' for nil:NilClass
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/motion-i18n-0.0.2/lib/tasks/translate.rb:26:in `block (3 levels) in <top (required)>'
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/motion-i18n-0.0.2/lib/tasks/translate.rb:25:in `open'
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/motion-i18n-0.0.2/lib/tasks/translate.rb:25:in `block (2 levels) in <top (required)>'
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/motion-i18n-0.0.2/lib/tasks/translate.rb:20:in `each'
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/motion-i18n-0.0.2/lib/tasks/translate.rb:20:in `block in <top (required)>'
...
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Users/ernesto/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/Users/ernesto/.rbenv/versions/2.1.1/bin/rake:23:in `load'
/Users/ernesto/.rbenv/versions/2.1.1/bin/rake:23:in `<main>'
Tasks: TOP => build:simulator => translate
It seems to me that the all_translations
variable assigned here is nil
. But I have no idea why.
Hi, as the docs suggest, I've added the gem to my gemfile (this is the only thing I did). When I rake, I get the following error. Did I miss something? Thanks!
rake aborted!
NoMethodError: undefined method `each' for nil:NilClass
/Users/nandersen/Documents/RubyMotion/lactase2/vendor/bundle/gems/motion-i18n-0.0.6/lib/motion-i18n-ios/translate.rb:25:in `block (2 levels) in ios_translate'
/Users/nandersen/Documents/RubyMotion/lactase2/vendor/bundle/gems/motion-i18n-0.0.6/lib/motion-i18n-ios/translate.rb:24:in `open'
/Users/nandersen/Documents/RubyMotion/lactase2/vendor/bundle/gems/motion-i18n-0.0.6/lib/motion-i18n-ios/translate.rb:24:in `block in ios_translate'
/Users/nandersen/Documents/RubyMotion/lactase2/vendor/bundle/gems/motion-i18n-0.0.6/lib/motion-i18n-ios/translate.rb:19:in `each'
/Users/nandersen/Documents/RubyMotion/lactase2/vendor/bundle/gems/motion-i18n-0.0.6/lib/motion-i18n-ios/translate.rb:19:in `ios_translate'
/Users/nandersen/Documents/RubyMotion/lactase2/vendor/bundle/gems/motion-i18n-0.0.6/lib/motion-i18n-ios/translate.rb:34:in `block in <top (required)>'
/Library/RubyMotion/lib/motion/project/template/ios.rb:186:in `block in <top (required)>'
Can we get one soon? Last release was in 2013 and there are a few new things that i'd like to use without having to reference git in my Gemfile... notably multiple substitution of variables.
Thanks!
Hello,
How can I set a locale? There seems to be only a way to get the locale
but that isn´t very helpful.
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.