www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Localization (i18n) Options

reply Gerald <me me.com> writes:
I have a GtkD application for Linux where I would like to support 
localization. The current options in D seem pretty limited with 
the most recent being i18n-d 
(https://github.com/JakobOvrum/i18n-d). My code is structured for 
GNU gettext but I could make the effort and convert it to the way 
i18n-d works if that's the best option. The only other issue I 
can see with it is that it doesn't support country-language 
variations and from past experience that's a pretty big deal 
(just ask any Brazilians!).

I'd prefer a GNU gettext implementation but I know that's not 
available since it has been listed as a GSOC project for a couple 
of years. I could roll my own GNU gettext implementation but that 
would be a significant effort taking away time from my project 
which I'd prefer to remain focused on.

Are there any other options out there that I might not be aware 
of?
Jan 16 2016
next sibling parent reply Gerald <me me.com> writes:
On Sunday, 17 January 2016 at 02:51:30 UTC, Gerald wrote:
 Are there any other options out there that I might not be aware 
 of?
And of course, 10 minutes later you stumble across a potential option. Looks like GLib exposes gettext and GtkD does wrap it so I'll play around with that and see if I can get it working. My apologies for the noise.
Jan 16 2016
parent reply Luis <luis.panadero gmail.com> writes:
On Sunday, 17 January 2016 at 03:03:14 UTC, Gerald wrote:
 On Sunday, 17 January 2016 at 02:51:30 UTC, Gerald wrote:
 Are there any other options out there that I might not be 
 aware of?
And of course, 10 minutes later you stumble across a potential option. Looks like GLib exposes gettext and GtkD does wrap it so I'll play around with that and see if I can get it working. My apologies for the noise.
Please, write a HowTo some where. GtkD lack of documentation it's very anoying.
Jan 18 2016
next sibling parent reply Gerald <me me.com> writes:
On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 On Sunday, 17 January 2016 at 03:03:14 UTC, Gerald wrote:
 On Sunday, 17 January 2016 at 02:51:30 UTC, Gerald wrote:
 Are there any other options out there that I might not be 
 aware of?
And of course, 10 minutes later you stumble across a potential option. Looks like GLib exposes gettext and GtkD does wrap it so I'll play around with that and see if I can get it working. My apologies for the noise.
Please, write a HowTo some where. GtkD lack of documentation it's very anoying.
I'll keep that in mind as I know I've struggled with that myself. I have a couple of blog posts on GtkD on my site that cover how to do a couple of interesting things that you can view here http://gexperts.com and I'll probably add more as I have time. I've also contributed a couple of demos to GtkD, one for multithreading with GTK and the other on using GIO actions and popovers. I also contributed a script that generates ddox for GtkD instead of candydoc, even though the content is the same the ddox is much better IMHO since it includes a search capability and cross references items. I hated in candydoc that it showed a method using GtkDialogFlags and I then had to grep for it to see what the flags actually are. In ddox it's all cross referenced so you can just click on the link to it to view it. Finally, if you are interested you can follow my two GtkD based projects, terminix and vgrep, on github (https://github.com/gnunn1 for concrete examples of working with GtkD.
Jan 18 2016
next sibling parent reply Luis <luis.panadero gmail.com> writes:
On Monday, 18 January 2016 at 14:00:05 UTC, Gerald wrote:
 On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 On Sunday, 17 January 2016 at 03:03:14 UTC, Gerald wrote:
 On Sunday, 17 January 2016 at 02:51:30 UTC, Gerald wrote:
 Are there any other options out there that I might not be 
 aware of?
And of course, 10 minutes later you stumble across a potential option. Looks like GLib exposes gettext and GtkD does wrap it so I'll play around with that and see if I can get it working. My apologies for the noise.
Please, write a HowTo some where. GtkD lack of documentation it's very anoying.
I'll keep that in mind as I know I've struggled with that myself. I have a couple of blog posts on GtkD on my site that cover how to do a couple of interesting things that you can view here http://gexperts.com and I'll probably add more as I have time. I've also contributed a couple of demos to GtkD, one for multithreading with GTK and the other on using GIO actions and popovers. I also contributed a script that generates ddox for GtkD instead of candydoc, even though the content is the same the ddox is much better IMHO since it includes a search capability and cross references items. I hated in candydoc that it showed a method using GtkDialogFlags and I then had to grep for it to see what the flags actually are. In ddox it's all cross referenced so you can just click on the link to it to view it. Finally, if you are interested you can follow my two GtkD based projects, terminix and vgrep, on github (https://github.com/gnunn1 for concrete examples of working with GtkD.
I browse your code and grestful code a few times. I did stuff with GtkD on a different approach, using GtkBuilder and Gtk autolink of functions by name. I try to avoid generating the GUI interface by code, so I can do changes editing an XML with a visual tool. I need to clean my code base before anyone could try to use it as example. I wrote a few years ago on a quick & dirty way. Were I can find the script to generate ddox for GtkD ? PD: I'm the only guy that think that a hypothetical implementation of GtkBuilder running on CTFE would be great ? So generates the GUI on compile time instead of parsing and generating stuff on runtime ?
Jan 18 2016
next sibling parent Mike Wey <mike-wey example.com> writes:
On 01/18/2016 04:06 PM, Luis wrote:
 Were I can find the script to generate ddox for GtkD ?
https://github.com/gtkd-developers/GtkD/blob/master/makeddox.sh -- Mike Wey
Jan 18 2016
prev sibling parent karabuta <karabutaworld gmail.com> writes:
On Monday, 18 January 2016 at 15:06:12 UTC, Luis wrote:
 On Monday, 18 January 2016 at 14:00:05 UTC, Gerald wrote:
 [...]
I browse your code and grestful code a few times. I did stuff with GtkD on a different approach, using GtkBuilder and Gtk autolink of functions by name. I try to avoid generating the GUI interface by code, so I can do changes editing an XML with a visual tool. I need to clean my code base before anyone could try to use it as example. I wrote a few years ago on a quick & dirty way. Were I can find the script to generate ddox for GtkD ? PD: I'm the only guy that think that a hypothetical implementation of GtkBuilder running on CTFE would be great ? So generates the GUI on compile time instead of parsing and generating stuff on runtime ?
+1
Jan 18 2016
prev sibling parent Johannes Pfau <nospam example.com> writes:
Am Mon, 18 Jan 2016 14:00:05 +0000
schrieb Gerald <me me.com>:

 On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 On Sunday, 17 January 2016 at 03:03:14 UTC, Gerald wrote:  
 On Sunday, 17 January 2016 at 02:51:30 UTC, Gerald wrote:  
 Are there any other options out there that I might not be 
 aware of?  
And of course, 10 minutes later you stumble across a potential option. Looks like GLib exposes gettext and GtkD does wrap it so I'll play around with that and see if I can get it working. My apologies for the noise.
Please, write a HowTo some where. GtkD lack of documentation it's very anoying.
I'll keep that in mind as I know I've struggled with that myself. I have a couple of blog posts on GtkD on my site that cover how to do a couple of interesting things that you can view here http://gexperts.com and I'll probably add more as I have time. I've also contributed a couple of demos to GtkD, one for multithreading with GTK and the other on using GIO actions and popovers.
Nice stuff. You should do some advertising for these nice blog posts. Posting to D.announce and adding links from gtkd.org would be great.
Jan 18 2016
prev sibling parent reply Gerald <me me.com> writes:
On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 Please, write a HowTo some where. GtkD lack of documentation 
 it's very anoying.
I've gotten this going with Terminix and posted some information what it took to get it going here: http://gexperts.com/wp/gtkd-and-localization/
Jan 24 2016
next sibling parent Luis <luis.panadero gmail.com> writes:
On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote:
 On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 Please, write a HowTo some where. GtkD lack of documentation 
 it's very anoying.
I've gotten this going with Terminix and posted some information what it took to get it going here: http://gexperts.com/wp/gtkd-and-localization/
:thumbsup:
Jan 24 2016
prev sibling parent reply Ivan Trombley <itrombley dot-borg.org> writes:
On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote:
 On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 Please, write a HowTo some where. GtkD lack of documentation 
 it's very anoying.
I've gotten this going with Terminix and posted some information what it took to get it going here: http://gexperts.com/wp/gtkd-and-localization/
I tried this out but I get this compile error: "Error: static variable c_g_dgettext cannot be read at compile time" Did you have any issues like this?
Nov 27 2017
parent reply Gerald <gerald.b.nunn gnail.com> writes:
On Tuesday, 28 November 2017 at 07:39:19 UTC, Ivan Trombley wrote:
 On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote:
 On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 Please, write a HowTo some where. GtkD lack of documentation 
 it's very anoying.
I've gotten this going with Terminix and posted some information what it took to get it going here: http://gexperts.com/wp/gtkd-and-localization/
I tried this out but I get this compile error: "Error: static variable c_g_dgettext cannot be read at compile time" Did you have any issues like this?
Nope, you can see how Tilix is doing localization in it's repo below. I haven't looked at the localization code in awhile so I can't remember how well it still aligns with that blog post. https://gitHub.com/gnunn1/tilux
Nov 29 2017
next sibling parent drug <drug2004 bk.ru> writes:
Gerald, I'd like to learn how to make deb packages, could you share your 
scripts etc you use to build packages for tilix?
Thank in advance)
Nov 29 2017
prev sibling parent reply Ivan Trombley <itrombley dot-borg.org> writes:
On Thursday, 30 November 2017 at 00:50:35 UTC, Gerald wrote:
 On Tuesday, 28 November 2017 at 07:39:19 UTC, Ivan Trombley 
 wrote:
 On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote:
 On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
 Please, write a HowTo some where. GtkD lack of documentation 
 it's very anoying.
I've gotten this going with Terminix and posted some information what it took to get it going here: http://gexperts.com/wp/gtkd-and-localization/
I tried this out but I get this compile error: "Error: static variable c_g_dgettext cannot be read at compile time" Did you have any issues like this?
Nope, you can see how Tilix is doing localization in it's repo below. I haven't looked at the localization code in awhile so I can't remember how well it still aligns with that blog post. https://gitHub.com/gnunn1/tilux
Page not found, 404. BTW, this is what I tried: import glib.Internationalization; string t(string text) { return Internationalization.dgettext([], text); } That generates these errors: ~/.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/glib/Internation lization.d(103,23): Error: static variable c_g_dgettext cannot be read at compile time ~/.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/glib/Internation lization.d(103,22): called from here: toString((*c_g_dgettext)(toStringz(domain), toStringz(msgid)), 0LU)
Nov 30 2017
next sibling parent drug <drug2004 bk.ru> writes:
it was typo, should be https://gitHub.com/gnunn1/tilix
Nov 30 2017
prev sibling parent Ivan Trombley <itrombley dot-borg.org> writes:
Figured it out. I was initializing some member strings where they 
were declared in a class. I just needed to move that 
initialization to the constructor.
Nov 30 2017
prev sibling parent Jakob Ovrum <jakobovrum gmail.com> writes:
On Sunday, 17 January 2016 at 02:51:30 UTC, Gerald wrote:
 I have a GtkD application for Linux where I would like to 
 support localization. The current options in D seem pretty 
 limited with the most recent being i18n-d 
 (https://github.com/JakobOvrum/i18n-d). My code is structured 
 for GNU gettext but I could make the effort and convert it to 
 the way i18n-d works if that's the best option. The only other 
 issue I can see with it is that it doesn't support 
 country-language variations and from past experience that's a 
 pretty big deal (just ask any Brazilians!).
FWIW, country variation is on the TODO list (issue tracker).
 I'd prefer a GNU gettext implementation but I know that's not 
 available since it has been listed as a GSOC project for a 
 couple of years. I could roll my own GNU gettext implementation 
 but that would be a significant effort taking away time from my 
 project which I'd prefer to remain focused on.
Part of the point behind i18n-d is that we can do better than gettext in D.
Jan 16 2016