Help regarding internationalization for bootstrap button

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

<%= f.submit t(’.Create Company’, :default => t(“helpers.links.Create
Company”)), :class => ‘btn btn-primary’ %>

Create Company => mention in the hi.bootstrap.yml file
Please, let me know where i am wrong.

Thanks…

A key is a symbol. Don’t use capitalization or whitespace in it.


Dheeraj K.

On Jul 17, 2013, at 4:39 AM, Colin L. [email protected] wrote:

<%= f.submit t(‘.Create Company’), :default => t("helpers.links.Create

Company"), :class => ‘btn btn-primary’ %>

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?

On 17 July 2013 12:24, Tushar P. [email protected] wrote:

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

<%= f.submit t(‘.Create Company’, :default => t(“helpers.links.Create
Company”)), :class => ‘btn btn-primary’ %>

I have not used internationalisation, but should that be
<%= f.submit t(‘.Create Company’), :default => t("helpers.links.Create

Company"), :class => ‘btn btn-primary’ %>

Colin

On Jul 17, 2013, at 5:56 AM, Dheeraj K. [email protected]
wrote:

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.

Pardon the follow up on myself

On Jul 17, 2013, at 7:55 AM, Tamara T. [email protected]
wrote:

Company")), :class => ‘btn btn-primary’ %>
Tushar, please paste in the segments from each of your translation files so we
can see the actual code?

Colin

Create Company => mention in the hi.bootstrap.yml file
Please, let me know where i am wrong.

Tushar, please try this: remove the default: from the t() call, and see
if you get the translation not found error?

<% f.submit t(‘.Create Company’), class: ‘btn btn-primary’ %>

Hi,
Here i mention my hi.bootstrap.yml file, and i use
create company => key use in form.html

<%= f.submit t(’.create company’, :default => t(“helpers.links.Create
Company”)), :class => ‘btn btn-primary’ %>

It works fine for Hindi, but it gives problem for English

hi:
helpers:
actions: “क्रिया”

links:
Edit: “संपादित करें”
new: “नई”
update: “अपडेट”
cancel: “रद्द करें”
enable: “द्रश्य”
disable: “अदृश्य”
Create Company: “कंपनी बनाएं”
Delete: “हटाना”

Let me know where i am wrong

As per your suggestion i only put one space between key & value, but it
still won’t work.

On 2013-Jul-18, at 04:51 , Tushar P. wrote:

actions: “क्रिया”

Let me know where i am wrong

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.

-Rob

On Jul 18, 2013, at 4:51 AM, Tushar P. wrote:

actions: “क्रिया”

Let me know where i am wrong

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?

Walter

On Jul 18, 2013, at 1:51 AM, Tushar P. [email protected]
wrote:

actions: “क्रिया”

Let me know where i am wrong

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.

Any idea why?

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