El Tuesday 24 February 2009 08:30:14 Wes Gamble escribió:
> cntrytwist wrote:
> > If you find a string that does not get caught by the missing
> > translation error, simply enclose the string inside as_()
> > Example
> > <%= link_to 'Done' ...
> > Change to
> > <%= link_to as_('done') ...
> > Add the following to en.yml
> > done: "Done"
>
> I'm confused about how to properly use this:
>
> I have this in my controller:
>
> active_scaffold :servers do |config|
> config.list.label = 'servers'
>
> and this in my en.yml file:
>
> en:
> active_scaffold:
> servers: "Servers"
>
> That works fine.
>
> If I try to use the "as_('servers')" syntax, as in:
>
> active_scaffold :servers do |config|
> config.list.label = as_('servers')
>
> then I get the translation error "translation missing: en,
> active_scaffold, Servers"
>
> When should as_() be used? In general, what does as_() do? I've always
> wondered.
You only should use as_ in requests (views, helpers or methods of
controlller), all translation methods as I18n.translate from rails i18n or
_() from gettext should be used only in requests. So you mustn't use as_ when
you are defining a class, as when you configure active_scaffold.
>
> Also, is there any concept in Rails >= 2.2 of not using locale files for
> a given "default" locale (like "en"). That way, we would only have to
> provide locale translations for the non-default locale?
Reading rails i18n guide I don't think so. rails i18n use symbols for
translation (instead of use english strings like gettext) and you must define
the string for all languages.
http://rails-i18n.org/wiki/pages/i18n-rails-guide
--
Sergio Cambra .:: entreCables S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---