[Xfce-i18n] Generating unique duplicate names
Dotan Kamber
kamberd at yahoo.com
Wed Nov 9 22:42:05 CET 2005
I wish it would but unfortuntly I can't see a way
it'll work in Hebrew.
Regards
Dotan
--- Benedikt Meurer
<benedikt.meurer at unix-ag.uni-siegen.de> wrote:
> Hey Daichi and translators,
>
> The following piece of code is used to generate
> unique names for
> duplicated/linked files:
>
> -------------------
> static const gchar * const THUNAR_NAMING[3][2] =
> {
> {
> N_ ("copy of %s"),
> N_ ("link to %s"),
> },
> {
> N_ ("another copy of %s"),
> N_ ("another link to %s"),
> },
> {
> N_ ("third copy of %s"),
> N_ ("third link to %s"),
> },
> };
>
> static inline gchar*
> thunar_naming_make_next (const gchar
> *source_name,
> guint n,
> ThunarNamingMode mode)
> {
> /* handle the easy cases */
> if (G_LIKELY (n == 0))
> return g_strdup (source_name);
> else if (n <= 3)
> return g_strdup_printf (gettext (THUNAR_NAMING[n
> - 1][mode]),
> source_name);
>
> /* we need to use ngettext here */
> if (mode == THUNAR_NAMING_MODE_COPY)
> return g_strdup_printf (ngettext ("%uth copy of
> %s",
> "%uth copy of
> %s", n),
> n, source_name);
> else
> return g_strdup_printf (ngettext ("%uth link to
> %s",
> "%uth link to
> %s", n),
> n, source_name);
> }
> -------------------
>
> For example, when you duplicate a file, it will call
> thunar_naming_make_next() until a filename is found,
> for which no file
> exists. Let's say, you duplicate "test.txt", then
> you'll get "copy of
> test.txt". When you duplicate again, you'll get
> "another copy of
> test.txt", then "third copy of test.txt", "4th copy
> of test.txt", and so on.
>
> As you can see the first 3 possibilities ("copy of",
> "another copy" and
> "third copy of") are special cases, and the
> remaining are just the
> number with an appended "th". This is required for
> english (because
> there's "st", "nd" and "rd" for 1 to 3, but "th" for
> (most of) the
> remaining).
>
> Now my question is: Is the above easily translatable
> to other languages
> (I know that it'll work for german and a bunch of
> other languages, but
> whatever e.g. non-european languages)? I don't care
> if the 20th
> duplicate's name doen't look right, but the first
> 1-5 duplicate names
> should be properly translatable.
>
> Benedikt
> _______________________________________________
> Xfce-i18n mailing list
> Xfce-i18n at xfce.org
> http://foo-projects.org/mailman/listinfo/xfce-i18n
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
More information about the Xfce-i18n
mailing list