Patch for -same strings, different contexts-
Hi,
Maybe found a solution for the 'same string, different context' issue. It is based on http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html , and has a very small impact on the code. It works (compile and run) on my computer (compiled under Unbuntu, gcc3.3, following the indications of the wiki), and behaves OK in French and in English. The patch is attached there : http://sourceforge.net/tracker/index.php?func=detail&aid=1203796&gro...
It only requires developpers to use the Q_("context|translatable_string) when translatable_string is something that can have different meanings in different context, or if the string is very short.
If this solution is ok for you, I can : - add some comments for translators on the already modified strings (only X,Y,W,L in src/select-toolbar.cpp and H,S,V in /src/dialogs/clonetiler.cpp - implement this solutions in some other cases (of short/ambiguous strings)
Regards,
Matiphas
Hi,
Translators and developers : now the code has a way to handle context for tanslatable strings.
* Developpers: in case you insert some very short or ambiguous comments, you can add a context prefix to the string (and use a different macro): Q_("context|string") instead of _("string"). The context part of the string will appear in translation files (.po), but won't be displayed during execution (the rest of the string also appears in .po files and is displayed of course)
example: in select-toolbar.cpp -> previously: GtkWidget * sp_select_toolbox_spinbutton(gchar *label, gchar *data, float lower_limit, GtkWidget *us, GtkWidget *spw, gchar *tooltip, gboolean altx) { ... GtkWidget *l = gtk_label_new(_(label)); ... }
...
gtk_container_add(GTK_CONTAINER(vb), sp_select_toolbox_spinbutton(_("W"), "width", 1e-3, us, spw, _("Width of selection"),FALSE));
-> now: GtkWidget * sp_select_toolbox_spinbutton(gchar *label, gchar *data, float lower_limit, GtkWidget *us, GtkWidget *spw, gchar *tooltip, gboolean altx) { ... GtkWidget *l = gtk_label_new(Q_(label)); ... }
...
gtk_container_add(GTK_CONTAINER(vb), sp_select_toolbox_spinbutton(_("select_toolbar|W"), "width", 1e-3, us, spw, _("Width of selection"),FALSE));
* Translators: In .po files you'll find : msgid "context|string_to_translate"
and you'll just have to translate like this : msgstr "translated_string"
* And why this ? well, because in this case, W implies width (in select-toolbar), but in a different place of the code, it may have a different meaning, and thus would have to be translated differently. Internatinalisation tools don't allow it by default (in this case you must have several .po files or different strings to translate). Now, in this case, just use the context trick, and internationalisation tools will do the job.
* I've not yet inserted comments about this in the code: I plan to do it this week. However, I've added a few lines in the wiki (in developpers page and translation page)
Regards,
Matiphas
participants (1)
-
unknown@example.com