~elementary-pantheon/contractor/master

« back to all changes in this revision

Viewing changes to src/Translations.vala

  • Committer: Victor
  • Date: 2013-05-20 06:07:44 UTC
  • mto: This revision was merged to the branch mainline in revision 127.
  • Revision ID: git-v1:18eac427613d99ad6130174410f170e71b55ca88
Remove underscores from strings containing mnemonics.

By design contracts need to use external translation domains,  usually provided by the applications they are based on. Sometimes the strings provided by these applications have mnemonics tied to them, and these only make sense in the application itself, so we remove the underscores from translatable strings to let the contracts use them in spite of that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
    public static string get_string (string domain, string to_translate) {
27
27
        add_domain (domain);
28
 
        return dgettext (domain, to_translate).dup ();
 
28
        string translated = dgettext (domain, to_translate);
 
29
 
 
30
        // By design contracts need to use external translation domains,
 
31
        // usually provided by the applications they are based on. Many of
 
32
        // the strings provided by these applications have Mnemonics tied
 
33
        // to them, and these only make sense in the application itself,
 
34
        // so we remove them here.
 
35
        return translated.replace ("_", "");
29
36
    }
30
37
 
31
38
    private static void add_domain (string domain) {