We should add an extension method on string:
public static string Localize (this string self)
{
return AddinManager.CurrentLocalizer.GetString (self);
}
So addin strings can be localized like:
"Hello, World!".Localize ()
instead.
Or maybe call it "_" if we can:
"Hello, World!"._ ()
David
On Sun, Jun 21, 2009 at 9:55 PM, Christopher James Halse Rogers <
[email protected]> wrote:
> Hello again all.
>
> There's a do-plugins branch up at lp:~raof/do-plugins/plugins-i18n that
> makes plugins actually use the translations that we have for them.
>
> For those people writing new plugins or modifying existing ones, here's
> a simple guide to ensure your plugins will use translations.
>
> 1) Use the Mono.Addins namespace, rather than Mono.Unix. Like so:
> """
> using Mono.Addins;
> """
>
> 2) All the strings that you want to be translatable need to be run
> through AddinManager.CurrentLocalizer.GetString (). This *replaces*
> Catalog.GetString ().
>
> An example:
> """
> AddinManager.CurrentLocalizer.GetString ("This message will be
> translatable");
> """
> or:
> """
> AddinManager.CurrentLocalizer.GetPluralString ("{0} plugin enabled",
> "{0} plugins enabled", numPlugins, numPlugins);
> """
>
> 3) Add a Localizer property to your Foo.addin.xml, such as
> """
> <Localizer type="Gettext" catalog="gnome-do-plugins"
> location="@expanded_datadir@/locale" />
> """
> 3a) If your plugin wants to use the existing gnome-do-plugins
> translations, you'll want to add this to Foo.addin.xml.in and include
> Foo/Resources/Foo.addin.xml to configure.ac
>
> You're now done.
>
> If your plugin isn't in the main gnome-do-plugins project, or you'd like
> to maintain it separately, you can change the Localizer to load a
> different set of translations; change the catalog if you produce
> Foo.pot, or if you want to use a different translation mechanism you can
> change type.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GNOME Do" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gnome-do?hl=en
-~----------~----~----~----~------~----~------~--~---