Vietnamese locale unable to load

AI-generated summary

Vietnamese Locale Issue

Minh_Quang_Vo is experiencing issues with loading the Vietnamese locale in Discourse. After changing the locale from “en” to “vi”, they receive a blank page with an error message.

Mittineague points out that “vi” is actually the locale string for Virgin Islands, not Vietnam, which uses “vn”. However, Mittineague later corrects themselves, stating that Discourse uses “vi” for Vietnamese.

techAPJ reproduces the issue and finds that the vi.js.erb file is missing. They add the file and suggest that Minh_Quang_Vo rebuild their instance using cd /var/discourse and ./launcher rebuild app. Additionally, techAPJ mentions that many Vietnamese locale files are missing and will be added later.

To resolve the issue, Minh_Quang_Vo should rebuild their instance and wait for the updated Discourse source code to be applied to their server.

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 · GitHub.

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 - #10 . 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.

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

NO

vi = Virgin Islands
vn = Vietnam

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

Hmmm,

Now I’m confused.

It seems Discourse is using “vi” for Vietnamese.

Maybe you need the transliteration yml too?

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

https://github.com/discourse/discourse/commit/f0653563ee5cf7376be5b236c5104661bbcd400b

@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:

https://github.com/discourse/discourse/blob/master/.tx/config#L3