Defect #13412

Routing error for GET "/javascripts/i18n/jquery.ui.datepicker-en-gb.js"

Added by Harry Garrood over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:Invalid Affected version:

Description

Steps to reproduce
Use en-gb locale
Create an issue
GET /issues/{id}

Log contains:

Started GET "/javascripts/i18n/jquery.ui.datepicker-en-gb.js" for 127.0.0.1 at 2013-03-09 16:51:25 +0000

ActionController::RoutingError (No route matches [GET] "/javascripts/i18n/jquery.ui.datepicker-en-gb.js"):
  actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  ...

However there is a jquery.ui.datepicker-en-GB.js. So it appears that this asset routes are case-sensitive.

I'm not sure what the best way to go about fixing this is. Renaming the file to all downcase did fix it. Alternatively https://github.com/carstengehling/route_downcaser might be a solution.

History

#1 Updated by Harry Garrood over 9 years ago

Ahh, I made a typo in the description and now I can't fix it! *shame*

#2 Updated by Harry Garrood over 9 years ago

the route_downcaser gem won't help -- I've just noticed it ignores asset paths. (https://github.com/carstengehling/route_downcaser#020)

#3 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Needs feedback
  • Target version set to 2.2.4

Use en-gb locale

How exactly do you use en-gb locale? If I set the language to "English (British)" in my account, I get the link to the javascript file with the proper case:

<script src="/javascripts/i18n/jquery.ui.datepicker-en-GB.js?1355659332" type="text/javascript"></script>

#4 Updated by Harry Garrood over 9 years ago

This is what I've done:

cd /path/to/redmine
rake db:drop db:create
# remove all plugins
rm -rf plugins/*
# I have Redmine checked out from SVN at trunk
svn revert -R .
rake db:migrate
rails s

Then:

  1. Visit Redmine and log in with admin:admin
  2. Go to Administration and press the 'Load default data' button. Language has defaulted to 'English (British)'
  3. Create an issue
  4. GET /issues/1
  5. Page contains: <script src="/javascripts/i18n/jquery.ui.datepicker-en-gb.js" type="text/javascript"></script>

Some more info:

  • User.find_by_login('admin').language returns an empty string.
  • request.env['HTTP_ACCEPT_HEADER'] in IssuesController#show returns "en-GB,en-US;q=0.8,en;q=0.6" (I'm using Chromium)
  • echo $LANG in terminal produces en_GB.UTF-8

Setting my language to en-GB explicitly doesn't appear to have any effect.

#5 Updated by Harry Garrood over 9 years ago

Oh this also probably is relevant -- here's a portion of the <select> tag in the /my/account page:

<option value="en-ind">English</option>
<option value="en-au">English</option>
<option value="en">English</option>
<option value="en-ca">English</option>
<option value="en-us">English</option>
<option value="en-bork">English</option>
<option value="en-gb">English (British)</option>
<option value="en-GB">English (British)</option>

Also, I18n.available_locales produces (non 'en*' ones removed):

[... :en, :"en-GB", :"en-au", :"en-bork", :"en-ca", :"en-gb", :"en-ind", :"en-us" ...]

#6 Updated by Jean-Philippe Lang over 9 years ago

Do you know where all these en-* locales come from? Redmine core only provides en and en-GB.

#7 Updated by Harry Garrood over 9 years ago

I will do some investigation.

#8 Updated by Harry Garrood over 9 years ago

Ah! It's because I had the faker gem in my Gemfile.local:

$ rails c
>> pp I18n.load_path
 [...]
 "/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/faker-1.1.2/lib/locales/en-gb.yml",
 "/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/faker-1.1.2/lib/locales/en-us.yml",
 "/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/faker-1.1.2/lib/locales/en-au.yml",
 "/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/faker-1.1.2/lib/locales/fr.yml",
 "/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/faker-1.1.2/lib/locales/en-ind.yml",
 [...]

#9 Updated by Daniel Felix over 9 years ago

Does everything work fine after removing this Gem? Could this issue be marked as invalid?

#10 Updated by Harry Garrood over 9 years ago

Everything does work fine after removing it. I'm not really sure what's going on. I guess it's not up to me to say whether the issue's invalid.

Having said that, re whether to close, I would lean towards 'no'; adding a gem to Gemfile.local shouldn't be having this effect, I don't think.

#11 Updated by Daniel Felix over 9 years ago

Well, but this seem to be something which is implemented by the gem self. I've added gems to my local file too, but this worked well.

Maybe the gem itself is broken?

#12 Updated by Harry Garrood over 9 years ago

Ok, I found what's causing it: https://github.com/stympy/faker/blob/master/lib/faker.rb#L9

Having seen that line, I don't think that's something which should be changed in Redmine. For anyone facing the same problem: put the gem into the :test group in Gemfile.local, and then it won't mess with I18n in development or production.

This issue should probably be closed as invalid. Sorry guys.

#13 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from Needs feedback to Closed
  • Target version deleted (2.2.4)
  • Resolution set to Invalid

OK, thanks for the feedback.

Also available in: Atom PDF