Bastion: gettext angular constant to be replace with translate service

Greetings,

TLDR: use translate() instead of gettext() once https://github.com/Katello/katello/pull/3895 is merged.

Currently in Bastion we use the gettext() function to mark strings for translations in our javascript code. Unfortunately this function only marks strings for translation and doesn't actually perform replacements: https://github.com/rubenv/angular-gettext/blob/master/src/index.js#L3. I have replaced the gettext constant with a translate service which both marks the string for translation as well as performing replacements, addressing the issue Bug #4785: angular-gettext's gettext function only works for extraction, need to also handle replacements - Katello - Foreman.

After this PR gets merged you should be injecting and using translate instead of gettext.

Thanks,
Walden

Walden:

Can you try setting

:mark_translated: true

in the settings.yaml file and see if this works across an install with
with katello installed? Previously, this was giving a null pointer
exception in the bastion code.

– bk

··· On 03/28/2014 11:46 AM, Walden Raines wrote: > Greetings, > > TLDR: use translate() instead of gettext() once https://github.com/Katello/katello/pull/3895 is merged. > > Currently in Bastion we use the gettext() function to mark strings for translations in our javascript code. Unfortunately this function only marks strings for translation and doesn't actually perform replacements: https://github.com/rubenv/angular-gettext/blob/master/src/index.js#L3. I have replaced the gettext constant with a translate service which both marks the string for translation as well as performing replacements, addressing the issue http://theforeman.org/issues/4785. > > After this PR gets merged you should be injecting and using translate instead of gettext. > > Thanks, > Walden >

How does angular-gettext work with multiple domains? I mean, how angular
will work when there are multiple plugins with translations?

For Rails gettext we enriched the upstream code to handle multiple
domains, so it is possible to search strings in multiple po files
(foreman.po, katello.po, pluginX.po) until a translation is found.

LZ

··· On Fri, Mar 28, 2014 at 11:46:25AM -0400, Walden Raines wrote: > Greetings, > > TLDR: use translate() instead of gettext() once https://github.com/Katello/katello/pull/3895 is merged. > > Currently in Bastion we use the gettext() function to mark strings for translations in our javascript code. Unfortunately this function only marks strings for translation and doesn't actually perform replacements: https://github.com/rubenv/angular-gettext/blob/master/src/index.js#L3. I have replaced the gettext constant with a translate service which both marks the string for translation as well as performing replacements, addressing the issue http://theforeman.org/issues/4785. > > After this PR gets merged you should be injecting and using translate instead of gettext. > > Thanks, > Walden > > -- > You received this message because you are subscribed to the Google Groups "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Bryan,

The error was fixed in https://github.com/Katello/katello/pull/3869, this now works as expected.

Cheers,
Walden

··· ----- Original Message ----- From: "Bryan Kearney" To: foreman-dev@googlegroups.com Sent: Saturday, March 29, 2014 9:45:38 AM Subject: Re: [foreman-dev] Bastion: gettext angular constant to be replace with translate service

On 03/28/2014 11:46 AM, Walden Raines wrote:

Greetings,

TLDR: use translate() instead of gettext() once https://github.com/Katello/katello/pull/3895 is merged.

Currently in Bastion we use the gettext() function to mark strings for translations in our javascript code. Unfortunately this function only marks strings for translation and doesn’t actually perform replacements: https://github.com/rubenv/angular-gettext/blob/master/src/index.js#L3. I have replaced the gettext constant with a translate service which both marks the string for translation as well as performing replacements, addressing the issue Bug #4785: angular-gettext’s gettext function only works for extraction, need to also handle replacements - Katello - Foreman.

After this PR gets merged you should be injecting and using translate instead of gettext.

Thanks,
Walden

Walden:

Can you try setting

:mark_translated: true

in the settings.yaml file and see if this works across an install with
with katello installed? Previously, this was giving a null pointer
exception in the bastion code.

– bk


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lukas,

In short, it doesn't.

We may have to contribute upstream to angular-gettext similar to what y'all did with Rails gettext.

Cheers,
Walden

··· ----- Original Message ----- From: "Lukas Zapletal" To: "foreman-dev" Sent: Tuesday, April 1, 2014 9:01:32 AM Subject: Re: [foreman-dev] Bastion: gettext angular constant to be replace with translate service

How does angular-gettext work with multiple domains? I mean, how angular
will work when there are multiple plugins with translations?

For Rails gettext we enriched the upstream code to handle multiple
domains, so it is possible to search strings in multiple po files
(foreman.po, katello.po, pluginX.po) until a translation is found.

LZ

On Fri, Mar 28, 2014 at 11:46:25AM -0400, Walden Raines wrote:

Greetings,

TLDR: use translate() instead of gettext() once https://github.com/Katello/katello/pull/3895 is merged.

Currently in Bastion we use the gettext() function to mark strings for translations in our javascript code. Unfortunately this function only marks strings for translation and doesn’t actually perform replacements: https://github.com/rubenv/angular-gettext/blob/master/src/index.js#L3. I have replaced the gettext constant with a translate service which both marks the string for translation as well as performing replacements, addressing the issue Bug #4785: angular-gettext’s gettext function only works for extraction, need to also handle replacements - Katello - Foreman.

After this PR gets merged you should be injecting and using translate instead of gettext.

Thanks,
Walden


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


You received this message because you are subscribed to the Google Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sorry… missed it. Thanks!

– bk

··· On 03/31/2014 08:42 AM, Walden Raines wrote: > Bryan, > > The error was fixed in https://github.com/Katello/katello/pull/3869, this now works as expected. >