Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion advice on how to handle error messages internationalization whit words that need inflection

Received: by 10.58.210.198 with SMTP id mw6mr4154217vec.22.1350517161036;
        Wed, 17 Oct 2012 16:39:21 -0700 (PDT)
X-BeenThere: play-framework@googlegroups.com
Received: by 10.220.224.8 with SMTP id im8ls1030768vcb.4.gmail; Wed, 17 Oct
 2012 16:39:13 -0700 (PDT)
Received: by 10.52.34.205 with SMTP id b13mr3370301vdj.3.1350517153177;
        Wed, 17 Oct 2012 16:39:13 -0700 (PDT)
Date: Wed, 17 Oct 2012 16:39:12 -0700 (PDT)
From: sas <open...@gmail.com>
To: play-framework@googlegroups.com
Message-Id: <ac893c99-95b0-4d1d-8257-20edb93b6ce3@googlegroups.com>
In-Reply-To: <3001b70f-16ae-40aa-b276-703e6fb3b2ae@googlegroups.com>
References: <4602fc31-047d-4caa-aebf-3eae47353b41@googlegroups.com>
 <0632fb62-9c5b-4e1f-bd67-12f9a52801ed@googlegroups.com>
 <3001b70f-16ae-40aa-b276-703e6fb3b2ae@googlegroups.com>
Subject: Re: [play x] advice on how to handle error messages
 internationalization whit words that need inflection
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_877_5172796.1350517152817"

------=_Part_877_5172796.1350517152817
Content-Type: multipart/alternative; 
	boundary="----=_Part_878_33204057.1350517152817"

------=_Part_878_33204057.1350517152817
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

the list of words is known before hand, but I want to use the same for

validate.empty=3D{0} not specified.
validate.duplicate=3DThere already exists a {0} with the {1} "{2}".

In the first case it would be "Idea not specified", and in the second=20
"There already exists an idea ..."

With that solution I would have to define

idea=3Didea
anIdea=3Dan idea

which would make everyting more comlicated than necessary...


On Wednesday, October 17, 2012 6:23:52 PM UTC-3, Marconi wrote:
>
> If you know the words beforehand, you could adopt a simpler strategy:
>
> en:
> idea=3Dan idea
> fact=3Da fact
>
> pt-BR:
> idea=3Duma id=C3=A9ia
> fact=3Dum fato
>
> But I believe that the problem discussed here is that the words are not=
=20
> known beforehand, i.e., they may come from user input. This is a very=20
> tricky problem to solve, indeed. Even if you had a list of nouns and=20
> gender, there could be ambiguities. For instance, in Brazilian Portuguese=
=20
> "a cara" means "the face", but "o cara" means "the guy" ("a" and "o" are=
=20
> the feminine and masculine definite articles, respectively).
>
> I really don't have a good answer to give you, but I can point you to a=
=20
> few resources that may or may not do a little better than Java messages:
>
> http://icu-project.org/
> http://code.google.com/p/gettext-commons/
>
> http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural=
-forms.html
> http://angularjs.org/#create-components
>
>
>
> On Wednesday, October 17, 2012 4:09:30 PM UTC-4, notalifeform wrote:
>>
>> Hi,
>>
>> I was thinking myself  to implement something like the 'quant' function=
=20
>> that is available in perl's Locale::Maketext,
>> see  http://perldoc.perl.org/Locale/Maketext.html#Utility-Methods
>>
>> e.g=20
>>
>> "[quant,_1,file,files,No files] matched your query.\n"
>>
>>
>> of course if will only be able deal with quantities..
>>
>> for genders you could maybe do something like
>>
>> [gender,_1,un,una]
>>
>> and have this information your messages file too=20
>>
>> idea=3Did=C3=A9e
>> idea.gender=3Dfemale
>>
>> building this logic into a play plugin will not be rocket science
>> (of course there are languages that will need more sophisticated rules=
=20
>> than this..
>>
>> I must admit it feels a bit like reinventing the wheel, but I didn't cam=
e=20
>> across a solution yet that seems easy to integrate myself...
>>
>> if you find any decent solution - please let me know.
>>
>> cheers,
>>
>> Robert
>>
>>
>>
>> =20
>>
>>
>>
>>
>> On Wednesday, October 17, 2012 5:00:12 PM UTC+2, sas wrote:
>>>
>>> This is not strictly play related, but I guess many of you may hava had=
=20
>>> the same trouble
>>>
>>> I'm trying to internationalize error messages like this:
>>>
>>> validate.empty=3D{0} not specified.
>>> validate.duplicate=3DThere already exists a {0} with the {1} "{2}".
>>>
>>> If I have a duplicate entity named "idea" the message I get is
>>>
>>> There already exists a idea with the name "new idea"
>>>
>>> for example
>>>
>>> The problem is that it should say "an idea" instead of "a idea"
>>>
>>> In spanish the problem is even worse, because sustantives have gender,=
=20
>>> and you should use different articles (instead of "a" you use "una" / "=
un")
>>>
>>> How do you handle this kind of situations? Is there some kind of=20
>>> inflector library that can handle different laguages? And would you=20
>>> integate it with the i18n.Messages functions?
>>>
>>> thanks a lot
>>>
>>> saludos
>>>
>>> sas
>>>
>>>
------=_Part_878_33204057.1350517152817
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

the list of words is known before hand, but I want to use the same for<div>=
<br></div><div><div>validate.empty=3D{0} not specified.</div><div>validate.=
duplicate=3DThere already exists a {0} with the {1} "{2}".</div></div><div>=
<br></div><div>In the first case it would be "Idea not specified", and in t=
he second "There already exists an idea ..."</div><div><br></div><div>With =
that solution I would have to define</div><div><br></div><div>idea=3Didea</=
div><div>anIdea=3Dan idea</div><div><br></div><div>which would make everyti=
ng more comlicated than necessary...</div><div><br><br>On Wednesday, Octobe=
r 17, 2012 6:23:52 PM UTC-3, Marconi wrote:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;">If you know the words beforehand, you could adopt a simpler st=
rategy:<br><br>en:<br>idea=3Dan idea<br>fact=3Da fact<br><br>pt-BR:<br>idea=
=3Duma id=C3=A9ia<br>fact=3Dum fato<br><br>But I believe that the problem d=
iscussed here is that the words are not known beforehand, i.e., they may co=
me from user input. This is a very tricky problem to solve, indeed. Even if=
 you had a list of nouns and gender, there could be ambiguities. For instan=
ce, in Brazilian Portuguese "a cara" means "the face", but "o cara" means "=
the guy" ("a" and "o" are the feminine and masculine definite articles, res=
pectively).<br><br>I really don't have a good answer to give you, but I can=
 point you to a few resources that may or may not do a little better than J=
ava messages:<br><br><a href=3D"http://icu-project.org/" target=3D"_blank">=
http://icu-project.org/</a><br><a href=3D"http://code.google.com/p/gettext-=
commons/" target=3D"_blank">http://code.google.com/p/<wbr>gettext-commons/<=
/a><br><a href=3D"http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/=
html_node/Plural-forms.html" target=3D"_blank">http://www.gnu.org/savannah-=
<wbr>checkouts/gnu/gettext/manual/<wbr>html_node/Plural-forms.html</a><br><=
a href=3D"http://angularjs.org/#create-components" target=3D"_blank">http:/=
/angularjs.org/#create-<wbr>components</a><br><br><br><br>On Wednesday, Oct=
ober 17, 2012 4:09:30 PM UTC-4, notalifeform wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">Hi,<div><br></div><div>I was thinking myself &nbsp;to imple=
ment something like the 'quant' function that is available in perl's Locale=
::Maketext,</div><div>see &nbsp;<a href=3D"http://perldoc.perl.org/Locale/M=
aketext.html#Utility-Methods" target=3D"_blank">http://perldoc.perl.org/<wb=
r>Locale/Maketext.html#Utility-<wbr>Methods</a></div><div><br></div><div>e.=
g&nbsp;</div><div><br></div><div><pre><span>"[quant,_1,file,files,No files]=
 matched your query.\n"</span></pre></div><div><br></div><div>of course if =
will only be able deal with quantities..</div><div><br></div><div>for gende=
rs you could maybe do something like</div><div><br></div><div><font face=3D=
"courier new, monospace">[gender,_1,un,una]</font></div><div><br></div><div=
>and have this information your messages file too&nbsp;</div><div><br></div=
><div><font face=3D"courier new, monospace">idea=3Did=C3=A9e</font></div><d=
iv><font face=3D"courier new, monospace">idea.gender=3Dfemale</font></div><=
div><br></div><div>building this logic into a play plugin will not be rocke=
t science</div><div>(of course there are languages that will need more soph=
isticated rules than this..</div><div><br></div><div>I must admit it feels =
a bit like reinventing the wheel, but I didn't came across a solution yet t=
hat seems easy to integrate myself...</div><div><br></div><div>if you find =
any decent solution - please let me know.</div><div><br></div><div>cheers,<=
/div><div><br></div><div>Robert</div><div><br></div><div><br></div><div><br=
></div><div>&nbsp;</div><div><br></div><div><br></div><div><br></div><div><=
br>On Wednesday, October 17, 2012 5:00:12 PM UTC+2, sas wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex">This is not strictly play related, but I guess m=
any of you may hava had the same trouble<div><br></div><div>I'm trying to i=
nternationalize error messages like this:</div><div><br></div><div><div>val=
idate.empty=3D{0} not specified.</div><div>validate.duplicate=3DThere alrea=
dy exists a {0} with the {1} "{2}".</div></div><div><br></div><div>If I hav=
e a duplicate entity named "idea" the message I get is</div><div><br></div>=
<div>There already exists a idea with the name "new idea"</div><div><br></d=
iv><div>for example</div><div><br></div><div>The problem is that it should =
say "an idea" instead of "a idea"</div><div><br></div><div>In spanish the p=
roblem is even worse, because sustantives have gender, and you should use d=
ifferent articles (instead of "a" you use "una" / "un")</div><div><br></div=
><div>How do you handle this kind of situations? Is there some kind of infl=
ector library that can handle different laguages? And would you integate it=
 with the i18n.Messages functions?</div><div><br></div><div>thanks a lot</d=
iv><div><br></div><div>saludos</div><div><br></div><div>sas</div><div><br><=
/div></blockquote></div></blockquote></blockquote></div>
------=_Part_878_33204057.1350517152817--

------=_Part_877_5172796.1350517152817--