Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 02, 2012 i18n | ||||
---|---|---|---|---|
| ||||
Hi, Is there any way for localizate and internationalizate messages? I were shocked if D has something like Fantom [http://fantom.org/doc/docLang/Localization.html]. Gettext is pretty ugly ;-) If not, any plannings? Thanks, Xan. |
February 02, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to xancorreu | On 02/02/2012 18:48, xancorreu wrote:
> Hi,
>
> Is there any way for localizate and internationalizate messages?
> I were shocked if D has something like Fantom
> [http://fantom.org/doc/docLang/Localization.html]. Gettext is pretty ugly ;-)
Is this just about supporting different human languages in your app?
You can put the strings output by your app in a separate file or in a section within the code file to which they apply, and use either version blocks (compile-time) or arrays (run-time) to choose between them.
Under Windows, you can use a stringtable resource. It's possible to make resources language-specific, but I don't know how.
Stewart.
|
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to xancorreu | "xancorreu" <xancorreu@gmail.com> wrote: > Hi, > > Is there any way for localizate and internationalizate messages? > I were shocked if D has something like Fantom > [http://fantom.org/doc/docLang/Localization.html]. Gettext is pretty ugly > ;-) I use small D script to internationalize Delphi projects. It's not perfect, but it's simple and easy to modify for one's needs. https://gist.github.com/1728860 |
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Al 02/02/12 20:40, En/na Stewart Gordon ha escrit: > On 02/02/2012 18:48, xancorreu wrote: >> Hi, >> >> Is there any way for localizate and internationalizate messages? >> I were shocked if D has something like Fantom >> [http://fantom.org/doc/docLang/Localization.html]. Gettext is pretty ugly ;-) > > Is this just about supporting different human languages in your app? > > This is by displaying different messages depending of system locale of the user. > > Stewart. |
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex_Dovhal | Al 03/02/12 09:09, En/na Alex_Dovhal ha escrit:
> "xancorreu"<xancorreu@gmail.com> wrote:
>> Hi,
>>
>> Is there any way for localizate and internationalizate messages?
>> I were shocked if D has something like Fantom
>> [http://fantom.org/doc/docLang/Localization.html]. Gettext is pretty ugly
>> ;-)
> I use small D script to internationalize Delphi projects. It's not perfect,
> but it's simple and easy to modify for one's needs.
> https://gist.github.com/1728860
>
>
Thank you very much for your solution. I deduce so that there is no "official" support for that. If it's, it's a pain.
Xan.
|
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to xancorreu | > I deduce so that there is no "official" support for that. If it's, it's a pain.
Pain? Writing such a system can be done in a couple of lines.
|
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Al 03/02/12 18:07, En/na Trass3r ha escrit:
>> I deduce so that there is no "official" support for that. If it's, it's a pain.
>
> Pain? Writing such a system can be done in a couple of lines.
How? I don't know how to do that. How to read user current locale?
An official version could simplify the things: people should not wrtite their own code....
Xan.
|
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
On Fri, Feb 03, 2012 at 09:03:54PM +0100, xancorreu wrote: > Al 03/02/12 18:07, En/na Trass3r ha escrit: > >>I deduce so that there is no "official" support for that. If it's, it's a pain. > > > >Pain? Writing such a system can be done in a couple of lines. > > How? I don't know how to do that. How to read user current locale? An official version could simplify the things: people should not wrtite their own code.... [...] Write your own version and submit it for review/improvement. Then it'll become official. :) T -- For every argument for something, there is always an equal and opposite argument against it. Debates don't give answers, only wounded or inflated egos. |
February 03, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
03.02.2012 22:03, xancorreu пишет: > Al 03/02/12 18:07, En/na Trass3r ha escrit: >>> I deduce so that there is no "official" support for that. If it's, it's a pain. >> >> Pain? Writing such a system can be done in a couple of lines. > > How? I don't know how to do that. How to read user current locale? > An official version could simplify the things: people should not wrtite their own code.... > > Xan. > I doubt this is a good argument: "I don't know it, so it should be done for me". Anyway, for windows you probably need to use this function, or related ones: http://msdn.microsoft.com/en-us/library/windows/desktop/dd318136(v=vs.85).aspx I don't know how the thing is done on Unix family systems though, but as usual - Google is your best friend. |
February 04, 2012 Re: i18n | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | On Thursday, 2 February 2012 at 19:40:14 UTC, Stewart Gordon wrote: > Under Windows, you can use a stringtable resource. It's possible to make resources language-specific, but I don't know how. With LANGUAGE statement? http://msdn.microsoft.com/en-us/library/windows/desktop/aa381019%28v=vs.85%29.aspx |
Copyright © 1999-2021 by the D Language Foundation