0
votes

I've recently updated my Ruby on Rails project and then when I try to run the rake i18n:js:export command, I'm getting the following error

uninitialized constant I18n::INTERPOLATION_PATTERN

This happens in both windows 8.1 and centos6 machines.

My ruby version is: 1.8.7 in windows and 1.9.3 in CentOS6 Rails version: 3.0.9

I'm clueless in this spot and tried to find a solution, and couldn't find a correct one.

I'm using i18n-js version 2.1.2

I tried updating it to version 3.0.0.rc5 but still no luck.

Anyone came across any issues similar to this? I'm eagerly expecting a solution to fix this issue.

enter image description here

/* RESULT AFTER RUNNING WITH TRACE */

** Invoke i18n:js:export (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute i18n:js:export rake aborted! uninitialized constant I18n::INTERPOLATION_PATTERN c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js.rb:72:in block in configured_segments' c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js.rb:70:in each' c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js.rb:70:in each_wit h_object' c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js.rb:70:in configur ed_segments' c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js.rb:83:in translat ion_segments' c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js.rb:46:in export!'

c:/Ruby193/lib/ruby/gems/1.9.1/gems/i18n-js-2.1.2/lib/i18n-js/rake.rb:9:in bloc k (2 levels) in <top (required)>' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:236:in call' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:236:in block i n execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:231:in each' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:231:in execute ' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:175:in block i n invoke_with_call_chain' c:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:168:in invoke_ with_call_chain' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'

c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:149:in invoke_task' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:106:in block (2 levels) in top_level' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:106:in each' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:106:in block in top_level' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:115:in run_with_threads' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:100:in top_level' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:78:in b lock in run' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:165:in standard_exception_handling' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/lib/rake/application.rb:75:in r un' c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.1/bin/rake:33:in ' c:/Ruby193/bin/rake:23:in load' c:/Ruby193/bin/rake:23:in' Tasks: TOP => i18n:js:export

Thanks

1
Is there more stack trace? Does it reference a line in your file, and if so what is the code on that line?Beartech
@Beartech: I've updated the question and now added the stack trace from the centos. Could you please check itMujahid
When you say you updated, what did you change? Do you mean you updated the Rails version? You could try running the rake command with --trace to get more info. It's complaining that it can't find the constant I18n::INTERPOLATION_PATTERN defined anywhere. Is there a require... missing somewhere?Beartech
Can you post your config/i18n-js.yml file?Beartech
@Beartech: I added the result after I run with trace. And this is my i18n-js file auto_export: no translations: - file: "public/javascripts/translations.js" only: "*" asset_pipeline: yes Mujahid

1 Answers

0
votes

I know this is an outdated issue, but you may want to look at this recent SO question. It details how I ran into a similar issue and how it was resolved:

upgrading to ruby 2.3.0 NameError: uninitialized constant I18n::Config::Backend

Look through your rake files and see if you have any references to the Translation helper.

Removing include ActionView::Helpers::TranslationHelper and replacing (t "some_text") with (I18n.t "some_text") completely resolved the issue.