On Wed, 2004-11-17 at 23:01 +0100, Christophe Fergeau wrote: > > > I recall that this came up before and someone indicated that it might be > > > more difficult for translators that way. > > > > Hmm. Because it would mess up how gettext extracts strings into .po > > files or something? I'll have a look after you commit. > > Yep, I started to change some %lld to G_GUINT64_FORMAT a while ago until > I noticed that strings like > "Time remaining: %lld minutes" (dummy example) > were replaced with > "Time remaining: " > " minutes" > in the .po file, which is a big annoyance for translators: in the latter > case, there are many languages where the string won't be properly > translateable. Ok, I had a crack at fixing this. I can't test/apply because I don't have an existing jhbuild at the moment, and freedesktop.org being down makes jhbuild not work. Can someone try this patch and commit it to 0.9 if it works?
* looking for rhythmbox-devel gnome org--2004/rhythmbox--main--0.9--patch-149 to compare with * comparing to rhythmbox-devel gnome org--2004/rhythmbox--main--0.9--patch-149 M sources/rb-playlist-source-recorder.c * modified files --- orig/sources/rb-playlist-source-recorder.c +++ mod/sources/rb-playlist-source-recorder.c @@ -1094,6 +1094,28 @@ return TRUE; } +char * +evilly_substitute_translation (const char *translation, + const char *key, + const char *value, + const char *replacement) +{ + const char *keypos; + + keypos = strstr (fmt, key); + if (keypos) { + char *real_fmt; + char *fmt_start; + fmt_start = g_strndup (fmt, keypos - translation); + real_fmt = g_strdup_printf ("%s%s%s", + fmt_start, replacement, + keypos+2); + g_free (fmt_start); + return real_fmt; + } else + return NULL; +} + void rb_playlist_source_recorder_start (RBPlaylistSourceRecorder *source, GError **error) @@ -1118,16 +1140,29 @@ media_duration = rb_recorder_get_media_length (source->priv->recorder, NULL); if ((media_duration < 0) && (duration > 4440)) { - message = g_strdup_printf (_("This playlist is %lld minutes long. " - "This exceeds the length of a standard audio CD. " - "If the destination media is larger than a standard audio CD " - "please insert it in the drive and try again."), - duration / 60); + char *fmt; + fmt = evilly_substitute_translation (_("This playlist is %lld minutes long. " + "This exceeds the length of a standard audio CD. " + "If the destination media is larger than a standard audio CD " + "please insert it in the drive and try again."), + "%lld", + G_GINT64_FORMAT); + + if (fmt) + message = g_strdup_printf (fmt, duration / 60); + g_free (fmt); } else if ((media_duration > 0) && (media_duration <= duration)) { - message = g_strdup_printf (_("This playlist is %" G_GINT64_FORMAT " minutes long. " - "This exceeds the %" G_GINT64_FORMAT " minute length of the media in the drive."), - duration / 60, - media_duration / 60); + char *fmt; + + fmt = evilly_substitute_translation (_("This playlist is %lld minutes long. " + "This exceeds the %lld minute length of the media in the drive."), + "%lld", + G_GINT64_FORMAT); + if (fmt) + message = g_strdup_printf (fmt, + duration / 60, + media_duration / 60); + g_free (fmt); } if (message) { @@ -1140,12 +1175,25 @@ } if (!check_tmp_dir (source, error)) { - guint64 mib_needed = rb_playlist_source_recorder_estimate_total_size (source) / 1048576; - - error_dialog (source, - _("Could not find temporary space!"), - _("Could not find enough temporary space to convert audio tracks. %" G_GUINT64_FORMAT " MiB required."), - mib_needed); + guint64 mib_needed; + const char *fmt; + const char *percent_d; + + fmt = evilly_substitute_translation _("Could not find enough temporary space to convert audio tracks; %llu MiB required.", + "%llu", + G_GUINT64_FORMAT); + mib_needed = rb_playlist_source_recorder_estimate_total_size (source) / 1048576; + + if (fmt) + error_dialog (source, + _("Could not find temporary space!"), + fmt, + mib_needed); + else + error_dialog (source, + _("Could not find temporary space!"), + ""); + g_free (fmt); return; }
Attachment:
signature.asc
Description: This is a digitally signed message part