www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - i18n

reply xancorreu <xancorreu gmail.com> writes:
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.
Feb 02 2012
next sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
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.
Feb 02 2012
prev sibling next sibling parent "Alex_Dovhal" <alex_dovhal yahoo.com> writes:
"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
Feb 03 2012
prev sibling next sibling parent xancorreu <xancorreu gmail.com> writes:
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.

Feb 03 2012
prev sibling next sibling parent xancorreu <xancorreu gmail.com> writes:
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
 ;-)

but it's simple and easy to modify for one's needs. https://gist.github.com/1728860

"official" support for that. If it's, it's a pain. Xan.
Feb 03 2012
prev sibling next sibling parent Trass3r <un known.com> writes:
 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.
Feb 03 2012
prev sibling next sibling parent xancorreu <xancorreu gmail.com> writes:
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.
Feb 03 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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.
Feb 03 2012
prev sibling next sibling parent Mantis <mail.mantis.88 gmail.com> writes:
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.
Feb 03 2012
prev sibling next sibling parent "Kagamin" <spam here.lot> writes:
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
Feb 04 2012
prev sibling parent "Kagamin" <spam here.lot> writes:
Also 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381050%28v=vs.85%29.aspx
Feb 04 2012