Rotating simulator & similar functions are not working due to missing translations when my translations are loaded

39 views
Skip to first unread message

Carmen

unread,
May 22, 2013, 6:22:47 PM5/22/13
to frank-...@googlegroups.com
Hi All,

I'm working on a new app that has a native ios login screen and once you sign in we're using webview to display http content.

This new app does not have Frank embedded in it like our previous app did. So now I'm doing frank build, launch, inspect and all is working well on 1.1.12.

I added some rotation steps and they worked fine.

Then I proceeded to add in the necessary files to support localization for Italian & French. I created an env_locale.rb file that loads the yml file based on the environment variable I set on the command line when running my cucumber tests.

When I do that, the rotation steps no longer work and I see this:

|71:238: execution error: System Events got an error: Can’t get process "translation missing: en.iphone_simulator". (-1728)
^Z

It appears that there's a conflict and that only my files are loaded and yours are ignored? I'm including the contents of my env_locale.rb file and the command line usage.  When I completely comment out this file, the rotations work as expected. How can I load my translations and yours too?

Thank you,
Carmen

$locale_env = ENV['LOCALE'] || "en"
$running_locally = ENV['CMB'] || "no"

case $locale_env
when "fr"
  $locale = "French"
  I18n.locale = :fr
  I18n.backend.load_translations(File.dirname(File.dirname(__FILE__)) + '/support/locales/fr.yml')
  YAML::load_file(File.dirname(File.dirname(__FILE__)) + '/support/locales/fr.yml')
when "it"
  $locale = "Italian"
  I18n.locale = :it
  I18n.backend.load_translations(File.dirname(File.dirname(__FILE__)) + '/support/locales/it.yml')
  YAML::load_file(File.dirname(File.dirname(__FILE__)) + '/support/locales/it.yml')
when "de"
  $locale = "German"
  I18n.locale = :de
  I18n.backend.load_translations(File.dirname(File.dirname(__FILE__)) + '/support/locales/de.yml')
  YAML::load_file(File.dirname(File.dirname(__FILE__)) + '/support/locales/de.yml')
else
  $locale = "English"
  I18n.locale = :en
  I18n.backend.load_translations(File.dirname(File.dirname(__FILE__)) + '/support/locales/en.yml')
  YAML::load_file(File.dirname(File.dirname(__FILE__)) + '/support/locales/en.yml')
end # end case

 cucumber LOCALE="en" -r features features/smoke/smoke_test.feature

Carmen

unread,
May 23, 2013, 1:23:51 PM5/23/13
to frank-...@googlegroups.com
Hi All,

It does seem that my translations files are the last to be loaded and thus are overwriting Pete's files. If I copy the translations and enter them into my translation file, everything works like a charm.

I don't know much about I18n but there's got to be a way to append my translations to yours? Perhaps when loading or setting the path it should be a "+="

Thanks,
Carmen

Peter Hodgson

unread,
May 24, 2013, 12:45:02 AM5/24/13
to frank-...@googlegroups.com
Rather than putting all the different locales in different files you can combine them into one file (the way we do in https://github.com/moredip/Frank/blob/master/gem/lib/frank-cucumber/localize.yml), and then tell i18n to use both the Frank file and your file by replacing that case statement with something like:

$locale_env = ENV['LOCALE'] || "en"
$running_locally = ENV['CMB'] || "no"

I18n.locale = $locale_env.to_sym
I18n.load_path = << File.expand_path( "../support/localize.yml", __FILE__ )
I18n.backend.reload!

That's assuming your combined localization file is in support/localize.yml. 

I /think/ that might do the trick.  

Cheers,
Pete
  




--
You received this message because you are subscribed to the Google Groups "Frank" group.
To unsubscribe from this group and stop receiving emails from it, send an email to frank-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 




Reply all
Reply to author
Forward
0 new messages