After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703601 - Make strings translatable
Make strings translatable
Status: RESOLVED FIXED
Product: gnome-music
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks:
 
 
Reported: 2013-07-04 11:07 UTC by Arnel Borja
Modified: 2013-08-12 15:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Arnel Borja 2013-07-04 11:07:08 UTC
Many strings are still not set as translatable in the sources. The gettext domain is also not set. Translation domains are not set in .ui files.


Notes for developers/contributors for i18n:

- Use double quotes for strings that are translatable, use single quotes
  otherwise. This will make looking for translatable strings easier.

- Use _() so that the strings will be translated at runtime. Check first if the
  source file already has a "const _ = imports.gettext.gettext;" line, if not,
  add it after the "imports.gi.*" constants.

- Use contexts if the string are too short. For example, C_("Song Title",
  "Title") instead of just _("Title"). Check first if the source file already
  has a "const C_ = imports.gettext.gettext;" line, if not, add it after
  "const _ = imports.gettext.gettext;" line. Add that line too if not available.

- Add "Translators:" comments to strings where the context cannot be easily
  understood, or there are placeholders (and it is not easily understood).
  Something like this:
    // Translators: "Songs" refers to the Songs view

- Use ngettext if strings have numbers/etc so that they will be properly
  translated when in plural:
    Gettext.ngettext("%d day ago", "%d days ago", days).format(days);
  Check first if the source file already has a
  "const Gettext = imports.gettext;" line, if not, add it before
  "const _ = imports.gettext.gettext;" line. Add that line too if not available.

- Move translatable strings to .ui files if possible.

- When editing .ui files in Glade, made sure to set the translation domain to
  "gnome-music" by going to main menu then:
     File > Properties > Project Properties > Translation Domain

- In .ui files, make sure that strings like labels are set as translatable if
  it should be translated at runtime.

- Strings in the settings schema file should be translatable. Enum values, key
  names, etc. are not translatable though.

- Log messages ("log('Message');" lines) shouldn't be translated.

- All source files and .ui files should be added to po/POTFILES.in file.


For more info, refer to:

- Gettext info page, or here online:
  http://www.gnu.org/software/gettext/manual/html_node/index.html

- Internalization section of GLib Reference Manual using DevHelp, or online:
  https://developer.gnome.org/glib/stable/glib-I18N.html