help regarding internationalization for bootstrap button.

56 views
Skip to first unread message

Tushar Patil

unread,
Jul 17, 2013, 7:24:42 AM7/17/13
to rubyonrails-talk
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..

Colin Law

unread,
Jul 17, 2013, 7:39:09 AM7/17/13
to rubyonra...@googlegroups.com
On 17 July 2013 12:24, Tushar Patil <tushar...@gmail.com> 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

>
> Create Company => mention in the hi.bootstrap.yml file
> Please, let me know where i am wrong.
>
> Thanks..
>
> --
> 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/CAMFjjRe%2Bs1pkZ2Y9SWqitFGEFy3%2BkEZTNp7c34Luo-3mCfVXkg%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Dheeraj Kumar

unread,
Jul 17, 2013, 8:56:47 AM7/17/13
to rubyonra...@googlegroups.com
A key is a symbol. Don't use capitalization or whitespace in it.

-- 
Dheeraj Kumar

Tamara Temple

unread,
Jul 17, 2013, 10:55:21 AM7/17/13
to rubyonra...@googlegroups.com

On Jul 17, 2013, at 4:39 AM, Colin Law <cla...@googlemail.com> wrote:

> On 17 July 2013 12:24, Tushar Patil <tushar...@gmail.com> 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' %>
>

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?

> Colin
>
>>
>> Create Company => mention in the hi.bootstrap.yml file
>> Please, let me know where i am wrong.
>>
>> Thanks..
>>
>> --
>> 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/CAMFjjRe%2Bs1pkZ2Y9SWqitFGEFy3%2BkEZTNp7c34Luo-3mCfVXkg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> 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/CAL%3D0gLv6Q%2BuaW6PUZ86LXzcbJ9f5qy8Gd8oH56Y_BDw8o0Vwyg%40mail.gmail.com.

Tamara Temple

unread,
Jul 17, 2013, 10:57:12 AM7/17/13
to rubyonra...@googlegroups.com

On Jul 17, 2013, at 5:56 AM, Dheeraj Kumar <a.dheer...@gmail.com> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5AA6F9D7142841ECA13FCB5F26955AD0%40gmail.com.

Tamara Temple

unread,
Jul 17, 2013, 11:01:08 AM7/17/13
to rubyonra...@googlegroups.com
Pardon the follow up on myself…

On Jul 17, 2013, at 7:55 AM, Tamara Temple <tamous...@gmail.com> wrote:

>
> On Jul 17, 2013, at 4:39 AM, Colin Law <cla...@googlemail.com> wrote:
>
>> On 17 July 2013 12:24, Tushar Patil <tushar...@gmail.com> 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' %>
>>
>
> 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?
>
>> 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' %>


Tushar Patil

unread,
Jul 18, 2013, 4:51:06 AM7/18/13
to rubyonra...@googlegroups.com
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

Walter Lee Davis

unread,
Jul 18, 2013, 6:31:53 AM7/18/13
to rubyonra...@googlegroups.com

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

> 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

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

Tushar Patil

unread,
Jul 18, 2013, 6:59:18 AM7/18/13
to rubyonra...@googlegroups.com
As per your suggestion i only put one space between key  & value, but it still won't work.



--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/pGcnD5NNKmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.

To post to this group, send email to rubyonra...@googlegroups.com.

Walter Lee Davis

unread,
Jul 18, 2013, 7:05:24 AM7/18/13
to rubyonra...@googlegroups.com
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
> 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/CAMFjjRdcCH44Ftpn%2BhiYjLjTr3%2BphxfWvH1qTzeCKto_sdgwzg%40mail.gmail.com.

Rob Biedenharn

unread,
Jul 18, 2013, 4:23:45 PM7/18/13
to rubyonra...@googlegroups.com
On 2013-Jul-18, at 04:51 , Tushar Patil wrote:

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

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 Wednesday, July 17, 2013 8:31:08 PM UTC+5:30, tamouse wrote:
Pardon the follow up on myself…

On Jul 17, 2013, at 7:55 AM, Tamara Temple <tamous...@gmail.com> wrote:

>
> On Jul 17, 2013, at 4:39 AM, Colin Law <cla...@googlemail.com> wrote:
>
>> On 17 July 2013 12:24, Tushar Patil <tushar...@gmail.com> 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' %>
>>
>
> 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?
>
>> 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' %>



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

Tamara Temple

unread,
Jul 19, 2013, 3:23:08 AM7/19/13
to rubyonra...@googlegroups.com

On Jul 18, 2013, at 1:51 AM, Tushar Patil <tushar...@gmail.com> wrote:

> 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

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?

>
> On Wednesday, July 17, 2013 8:31:08 PM UTC+5:30, tamouse wrote:
> Pardon the follow up on myself…
>
> On Jul 17, 2013, at 7:55 AM, Tamara Temple <tamous...@gmail.com> wrote:
>
> >
> > On Jul 17, 2013, at 4:39 AM, Colin Law <cla...@googlemail.com> wrote:
> >
> >> On 17 July 2013 12:24, Tushar Patil <tushar...@gmail.com> 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' %>
> >>
> >
> > 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?
> >
> >> 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' %>
>
>
>
> --
> 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/45456acb-e2da-4981-ac67-78e71686736a%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages