Vietnamese locale unable to load


(Minh Quang Vo) #1

Hi all,

I’m just new to Ruby and Discourse. I would like create a new forum dedicated to Vietnamese folks. I just cloned the Discourse Docker at : GitHub - discourse/discourse_docker: A Docker image for Discourse.

I followed the instructions steps by steps :

  • Used standalone.yml => changed to app.yml
  • ./launcher bootstrap app
  • ./launcher start app

Everything worked fine, except the Vietnamese translation. I changed my locale from “en” to “vi” but when logging back, I just got a blank page. I saw the following error in my log

 Started GET "/javascripts/locales/vi.js" for 127.0.0.1 at 2016-03-01 01:16:37 +0000
    ActionController::RoutingError (No route matches [GET] "/javascripts/locales/vi.js")
    /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
    Processing by ExceptionsController#not_found as */*
      Rendered exceptions/not_found.html.erb within layouts/no_ember (7.6ms)
      Rendered layouts/_head.html.erb (0.5ms)
      Rendered common/_special_font_face.html.erb (0.9ms)
      Rendered common/_discourse_stylesheet.html.erb (4.5ms)
      Rendered application/_header.html.erb (0.6ms)
      Rendered text template (0.0ms)
    Completed 404 Not Found in 67ms (Views: 0.5ms | ActiveRecord: 16.0ms)

I went to google and found out How to add a new language . After having tried several times, I had the following issues:

app/assets/javascripts/locales/vi.js.erb doesn’t exist. I had to create one with the following content:

//= depend_on 'client.vi.yml'
//= require locales/i18n
<%= JsLocaleHelper.output_locale(:vi) %>

but when doing

cd /var/www/discourse
RAILS_ENV=production bundle exec rake assets:clobber assets:precompile

I got a weird error

Compressing: locales/vi-b5f2a031d44cf486f70e7c6573d4df7e.js
rake aborted!
Errno::ENOENT: No such file or directory - (/var/www/discourse/public/assets/locales/vi-b5f2a031d44cf486f70e7c6573d4df7e.js, /var/www/discourse/public/assets/locales/_vi-b5f2a031d44cf486f70e7c6573d4df7e.js)
/usr/local/lib/ruby/2.0.0/fileutils.rb:519:in `rename'
/usr/local/lib/ruby/2.0.0/fileutils.rb:519:in `block in mv'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/usr/local/lib/ruby/2.0.0/fileutils.rb:508:in `mv'
/var/www/discourse/lib/tasks/assets.rake:173:in `block (2 levels) in <top (required)>'
/var/www/discourse/lib/tasks/assets.rake:160:in `each'
/var/www/discourse/lib/tasks/assets.rake:160:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.0.0/bin/rake:22:in `load'
/var/www/discourse/vendor/bundle/ruby/2.0.0/bin/rake:22:in `<main>'
Tasks: TOP => assets:precompile

Please advise what I should do to enable Vietnamese locale. Thanks.


(Jeff Atwood) #2

Is that the correct locale string? Did you check Transifex?


(Mittineague) #3

NO

vi = Virgin Islands
vn = Vietnam


(Tuan Anh Tran) #4

i made mistake like this sometimes. it’s a bit confusing vi_VN


(Mittineague) #5

Hmmm,

Now I’m confused.

It seems Discourse is using “vi” for Vietnamese.



Maybe you need the transliteration yml too?


(Arpit Jalan) #6

Yes, this was a legit issue and I was able to repro it. I just added the vi.js.erb file:

@Minh_Quang_Vo can you try rebuilding your instance again?

cd /var/discourse
./launcher rebuild app

This should be fixed once the Discourse source code is updated on your server.


Also, I just noticed that there are many more Vietnamese locale files missing, as the original PR was incomplete. I will add all Vietnamese locale files later today.


Yes, that is correct! Because:


(Jeff Atwood) #7