David Barta

Joined

2,180 Experience
21 Lessons Completed
0 Questions Solved

Activity

Here is the solution for anyone running into this problem with Hebrew or other languages. This is a database collation issue. My environment is postgresql 12 on Mac OS Big Sur.

Change the collation for the table column that contains the Hebrew text to be sorted to:
pg_catalog."he-IL-x-icu"

I used the pgadmin application for this: navigated to Servers/PostgreSQL 12/Databases//schemas(1)/public/Tables//columns/.Click on the column name, and then click on Edit. In the Edit dialog that opens, click on Definition, and select the proper collation for your language in the Collation field. I had to do a bit of research to find the right value for Hebrew on a Mac.

BTW, on Heroku I had no problems with the Hebrew collation, it seems that on their database the collation that is defined works well.

I've encountered a specific problem in I18n with Hebrew which is an RTL language. How do you customize ActiveRecord's 'order' query so that the sorting is done correctly on a column which is in Hebrew? It seems not to work at all.

Run first rails webpacker:install and override the previous installation of webpacker, then rails webpacker:install:vue

This was solved by using webpacker 5.2.1 instead of the version in the jumpstart pro template (6.0.0.pre2)

rails webpacker:install:vue
rails aborted!
Don't know how to build task 'webpacker:install:vue' (See the list of available tasks with rails --tasks)

No I didn't! Thanks much

Hi Chris, on the jumpstartpro template, I created an he.yml file, as a copy of the en.yml, and translated a few strings to Hebrew. That's the only change I made, did not change the default locale or touch any other file. in applicalion.rb it still says config.i18n.available_locales = [:en]. But when launching the app, the strings were translated to Hebrew.
Somehow rails is picking the he.yml file for English as well. When I remove the file, translations revert back to English. Any idea why is that?

Thank you for a very good episode. In a future video perhaps you could expand on approaches to LTR languages like Hebrew, and adding the dir tag to html elements based on the I18n.locale.