how can i convert a locale file to another language

43 views
Skip to first unread message

fugee ohu

unread,
Jul 10, 2018, 12:19:29 PM7/10/18
to Ruby on Rails: Talk
All my keys have underscores if not in snake case then at the end  When I copy a file using google translate the colons, quotation marks and white spaces are all invalid yml cause they're not text, they're utf8 Anyone know another translator to use?

Hassan Schroeder

unread,
Jul 10, 2018, 2:12:28 PM7/10/18
to rubyonrails-talk
It would be a pretty sad "internationalization" system that didn't allow
UTF-8 characters, so -- spoiler alert -- there's no problem with UTF-8
in YAML locale files.

Maybe you can explain exactly what issue you're having, with sample
code?

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

fugee ohu

unread,
Jul 12, 2018, 11:14:10 AM7/12/18
to Ruby on Rails: Talk
The keys aren't supposed to be utf8 I meant the whole yaml file It doesn't work in google translate, the keys get converted to utf8 along with white space and quotes My question is exactly what I asked 

Hassan Schroeder

unread,
Jul 12, 2018, 12:44:50 PM7/12/18
to rubyonrails-talk
On Thu, Jul 12, 2018 at 8:14 AM, fugee ohu <fuge...@gmail.com> wrote:

> The keys aren't supposed to be utf8 I meant the whole yaml file It doesn't
> work in google translate, the keys get converted to utf8 along with white
> space and quotes My question is exactly what I asked

I have no idea what any of that is supposed to mean.

YAML keys can be UTF8.

Any google-translate-provided strings that I've tried work in locale files.

If you can't provide something to demonstrate the actual "problem",
then ¯\_(ツ)_/¯

fugee ohu

unread,
Jul 16, 2018, 2:46:22 PM7/16/18
to Ruby on Rails: Talk
If you copy the entire contents of a yaml  file from translate.google.com it won't be valid yaml for your rails app Whitespaces and quotes that get converted to utf8 are seemingly the cause of the problem 

fugee ohu

unread,
Jul 16, 2018, 2:54:29 PM7/16/18
to Ruby on Rails: Talk
Just wanna remind you that I asked this question because you can't do it with google translate  

Brandon McClelland

unread,
Jul 16, 2018, 3:46:54 PM7/16/18
to rubyonra...@googlegroups.com
I would not copy the entire yml file into Translate - it's going to arbitrarily try to translate both keys and values and introduce other artifacts, as you've already witnessed. You will probably get much better results with the extra effort of copying line by line the individual values into Translate; only translating the actual phrase in the Value itself then matching it to the correct key in your new translation yml file. 

It's a pretty standard practice to encode your files with UTF-8. The only reason I came across to not do so is if you're using UTF-16 for primarily Asian language sites. Handling that is probably better asked in a non-English Rails group. Your responses make it sound like you haven't set the default encoding in your text editor or IDE and are getting weird results when Google spits back translations in UTF-8 and you copy the result back into a file.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a3e2d123-bf30-4424-aca0-ddb316862a7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Brandon McClelland
User Support Technician
Steve Jackson Games
Reply all
Reply to author
Forward
Message has been deleted
0 new messages