Hi,
I am trying to convert my application in hindi, I am stuck in the
renaming submit button name, It works fine for hindi but not working
for
english, it gives syntax error, here is my submit button code
In this case, probably not – the #t helper takes a default: option in
case the first item is not found in the translation tables.
I suspect the key ‘.Create Company’ to be the culprit – and actually I
think the leading ‘.’ in this case might be the problem. Very hard to
tell without seeing the translation tables. Making a translation key a
spaced phrase with capitals is unusual as well – these things are keys,
and just seeing this seems odd to me. It might work? It certainly seems
to be working for the default translation token.
Tushar, please paste in the segments from each of your translation files
so we can see the actual code?
Hi,
I am trying to convert my application in hindi, I am stuck in the renaming
submit button name, It works fine for hindi but not working for english, it
gives syntax error, here is my submit button code
A key is a symbol. Don’t use capitalization or whitespace in it.
Dheeraj, this was my understanding as well, although the quoted
dot-element strings seem to work as non-symbols. I’ve not seen spaces
and capitals, but I also see that the same construct is used in the
default: t() call in Tushar’s code.
Have you tried putting quotes around the key having a space?
“Create Company”: “कंपनी बनाएं”
Having extra space between the : and the value does not matter
(especially since you have a quoted value). The only difference that an
unquoted value would have is all the leading spaces would be removed
from the value.
YAML has very specific white-space requirements. Make sure you haven’t
substituted a tab for two spaces somewhere. Also, is this bit you’ve
quoted here correct? I have only ever seen a single space after the
colon when defining a string value. Do the quotes make what you put here
okay?
Well, first problem I’m noting is that you’re saying it works with
you’re hindi file, and you posted your hindi file. You say it doesn’t
work with english, but you didn’t post the english translation file.
You may want to try this: http://www.yamllint.com And I know you already
know this, but make sure your text editor is giving you UTF-8
code-points for your non-ASCII characters. BBEdit can help with this.
Walter
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.