Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handle localized values nested in code #1552

Open
hangy opened this issue Dec 3, 2018 · 3 comments
Open

Better handle localized values nested in code #1552

hangy opened this issue Dec 3, 2018 · 3 comments
Labels
🌐 i18n Regarding software localization
Projects

Comments

@hangy
Copy link
Member

hangy commented Dec 3, 2018

sub normalize_nutriment_value_and_modifier($$) {
my $value_ref = shift;
my $modifier_ref = shift;
if ($$value_ref =~ /nan/i) {
$$value_ref = '';
}
if ($$value_ref =~ /(\&lt;=|<=|\N{U+2264})( )?/) {
$$value_ref =~ s/(\&lt;=|<=|\N{U+2264})( )?//;
$modifier_ref = "\N{U+2264}";
}
if ($$value_ref =~ /(\&lt;|<|max|maxi|maximum|inf|inférieur|inferieur|less)( )?/) {
$$value_ref =~ s/(\&lt;|<|min|minimum|max|maxi|maximum|environ)( )?//;
$$modifier_ref = '<';
}
if ($$value_ref =~ /(\&gt;=|>=|\N{U+2265})/) {
$$value_ref =~ s/(\&gt;=|>=|\N{U+2265})( )?//;
$modifier_ref = "\N{U+2265}";
}
if ($$value_ref =~ /(\&gt;|>|min|mini|minimum|greater|more)/) {
$$value_ref =~ s/(\&gt;|>|min|mini|minimum|greater|more)( )?//;
$$modifier_ref = '>';
}
if ($$value_ref =~ /(env|environ|about|~|≈)/) {
$$value_ref =~ s/(env|environ|about|~|≈)( )?//;
$$modifier_ref = '~';
}
if ($$value_ref =~ /trace|traces/) {
$$value_ref = 0;
$$modifier_ref = '~';
}
if ($$value_ref !~ /\./) {
$$value_ref =~ s/,/\./;
}
}

This method contains several non-universal localized values, ie. "environ" or "inférieur", "less", "more". We should consider removing them from this method, and use some product language to evaluate the result.

@hangy hangy added the 🌐 i18n Regarding software localization label Dec 3, 2018
@hangy hangy added this to To Do in Server via automation Dec 3, 2018
@teolemon
Copy link
Member

teolemon commented Dec 3, 2018

@hangy also, we need to make the nutrients translatable

@aleene
Copy link
Contributor

aleene commented Jun 22, 2019

There is now a nutriments.txt taxonomy with translations.

@teolemon
Copy link
Member

We should rather make a list of such localizable parts of the code for easier access. Given the potential for regression, we're not going to move it outside the code.

@teolemon teolemon changed the title Remove localized values Better handle localized values nested in code Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌐 i18n Regarding software localization
Projects
Status: 🆕 New
Status: To discuss and validate
Server
  
To Do
Development

No branches or pull requests

3 participants