Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

175 lines
7.8 KiB
XML

<Type Name="Catalog" FullName="Mono.Unix.Catalog">
<TypeSignature Language="C#" Value="public class Catalog" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Catalog extends System.Object" />
<AssemblyInfo>
<AssemblyName>Mono.Posix</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>A wrapper to the <c>libintl</c> library providing message translation capabilities.</summary>
<remarks>
<example>
<para>The following example demonstrates the use of the
<see cref="T:Mono.Unix.Catalog" /> type. See also:
http://www.mono-project.com/Internationalization.</para>
<code lang="C#">// File: i18n.cs
using System;
using Mono.Unix;
public class i18n
{
public static void Main(string[] argv)
{
Catalog.Init ("i18n", "./locale");
Console.WriteLine (Catalog.GetString ("My name is") + " Enzo");
int i = 20;
Console.WriteLine (Catalog.GetPluralString ("I'm {0} year old.",
"I'm {0} years old.", i), i);
}
}
</code>
<para>To generate the translations, use:</para>
<code lang="sh">xgettext --from-code=UTF-8 i18n.cs -o es.po</code>
<para>Edit the translations in <c>es.po</c>, then compile the
translations and copy the file so that <c>libintl</c> can find
it:</para>
<code lang="sh">mkdir -p locale/es/LC_MESSAGES/
msgfmt es.po -o locale/es/LC_MESSAGES/i18n.mo</code>
<para>To run your example with the new translations:</para>
<code lang="sh">LANGUAGE=es mono i18n.exe</code>
</example>
</remarks>
</Docs>
<Members>
<Member MemberName="GetPluralString">
<MemberSignature Language="C#" Value="public static string GetPluralString (string s, string p, int n);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetPluralString(string s, string p, int32 n) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="s" Type="System.String" />
<Parameter Name="p" Type="System.String" />
<Parameter Name="n" Type="System.Int32" />
</Parameters>
<Docs>
<param name="s">A <see cref="T:System.String" /> containing the singular form of the string. It is also used as the key to search the catalog on.</param>
<param name="p">A <see cref="T:System.String" /> containing the plural form of the string.</param>
<param name="n">
An <see cref="T:System.Int32" /> containing a number that determines
which form of the string to return.
If <paramref name="n" /> is one, the translation for
<paramref name="s" /> is returned; otherwise, the translation for
<paramref name="p" /> is returned.
</param>
<summary>Returns a native language translation of a text whose form depends on the number passed to the method.</summary>
<returns>The translated string. If no message catalog can be found, the method returns the singular form if <paramref name="n" /> == 1, the plural form otherwise.</returns>
<remarks>
<example>
<para>The following example demonstrates the use of the
<see cref="T:Mono.Unix.Catalog" /> type. See also:
http://www.mono-project.com/Internationalization.</para>
<code lang="C#">// File: i18n.cs
using System;
using Mono.Unix;
public class i18n
{
public static void Main(string[] argv)
{
Catalog.Init ("i18n", "./locale");
Console.WriteLine (Catalog.GetString ("My name is") + " Enzo");
int i = 20;
Console.WriteLine (Catalog.GetPluralString ("I'm {0} year old.",
"I'm {0} years old.", i), i);
}
}
</code>
</example>
</remarks>
</Docs>
</Member>
<Member MemberName="GetString">
<MemberSignature Language="C#" Value="public static string GetString (string s);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetString(string s) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="s" Type="System.String" />
</Parameters>
<Docs>
<param name="s">A <see cref="T:System.String" /> containing the text to be translated. It is used as the key to search the catalog on.</param>
<summary>Returns a native language translation of the text passed as the parameter.</summary>
<returns>The translated string, if found in the catalog, <paramref name="s" /> otherwise.</returns>
<remarks>
<example>
<para>The following example demonstrates the use of the
<see cref="T:Mono.Unix.Catalog" /> type. See also:
http://www.mono-project.com/Internationalization.</para>
<code lang="C#">// File: i18n.cs
using System;
using Mono.Unix;
public class i18n
{
public static void Main(string[] argv)
{
Catalog.Init ("i18n", "./locale");
Console.WriteLine (Catalog.GetString ("My name is") + " Enzo");
int i = 20;
Console.WriteLine (Catalog.GetPluralString ("I'm {0} year old.",
"I'm {0} years old.", i), i);
}
}
</code>
</example>
</remarks>
</Docs>
</Member>
<Member MemberName="Init">
<MemberSignature Language="C#" Value="public static void Init (string package, string localedir);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Init(string package, string localedir) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="package" Type="System.String" />
<Parameter Name="localedir" Type="System.String" />
</Parameters>
<Docs>
<param name="package">A <see cref="T:System.String" /> containing the name of the package (domain) that is to be accessed.</param>
<param name="localedir">A <see cref="T:System.String" /> containing the top level directory (folder) under which the message catalog(s) are stored.</param>
<summary>Initialize the object instance by providing information required to build the base directory where the message catalog is stored.</summary>
<remarks>The path to the message catalogs is constructed as follows <c>localedir/locale/category/package</c>. In this notation <c>locale</c> and <c>category</c> are, respectively, the locale name and the message category name, such as <c>LC_MESSAGES</c>. The object is initialized so that it translates the strings retrieved from the on-disk catalog into the UTF-8 encoding.
</remarks>
</Docs>
</Member>
</Members>
</Type>