1<Type Name="Catalog" FullName="Mono.Unix.Catalog">
2  <TypeSignature Language="C#" Value="public class Catalog" />
3  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Catalog extends System.Object" />
4  <AssemblyInfo>
5    <AssemblyName>Mono.Posix</AssemblyName>
6    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
7    <AssemblyVersion>2.0.0.0</AssemblyVersion>
8    <AssemblyVersion>4.0.0.0</AssemblyVersion>
9  </AssemblyInfo>
10  <ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
11  <Base>
12    <BaseTypeName>System.Object</BaseTypeName>
13  </Base>
14  <Interfaces />
15  <Docs>
16    <summary>A wrapper to the <c>libintl</c> library providing message translation capabilities.</summary>
17    <remarks>
18      <example>
19        <para>The following example demonstrates the use of the
20      <see cref="T:Mono.Unix.Catalog" /> type.  See also:
21      http://www.mono-project.com/Internationalization.</para>
22        <code lang="C#">// File: i18n.cs
23using System;
24using Mono.Unix;
25
26public class i18n
27{
28    public static void Main(string[] argv)
29    {
30        Catalog.Init ("i18n", "./locale");
31        Console.WriteLine (Catalog.GetString ("My name is") + " Enzo");
32        int i = 20;
33        Console.WriteLine (Catalog.GetPluralString ("I'm {0} year old.",
34				    "I'm {0} years old.", i), i);
35    }
36}
37      </code>
38        <para>To generate the translations, use:</para>
39        <code lang="sh">xgettext --from-code=UTF-8 i18n.cs -o es.po</code>
40        <para>Edit the translations in <c>es.po</c>, then compile the
41      translations and copy the file so that <c>libintl</c> can find
42      it:</para>
43        <code lang="sh">mkdir -p locale/es/LC_MESSAGES/
44msgfmt es.po -o locale/es/LC_MESSAGES/i18n.mo</code>
45        <para>To run your example with the new translations:</para>
46        <code lang="sh">LANGUAGE=es mono i18n.exe</code>
47      </example>
48    </remarks>
49  </Docs>
50  <Members>
51    <Member MemberName="GetPluralString">
52      <MemberSignature Language="C#" Value="public static string GetPluralString (string s, string p, int n);" />
53      <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetPluralString(string s, string p, int32 n) cil managed" />
54      <MemberType>Method</MemberType>
55      <AssemblyInfo>
56        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
57        <AssemblyVersion>2.0.0.0</AssemblyVersion>
58        <AssemblyVersion>4.0.0.0</AssemblyVersion>
59      </AssemblyInfo>
60      <ReturnValue>
61        <ReturnType>System.String</ReturnType>
62      </ReturnValue>
63      <Parameters>
64        <Parameter Name="s" Type="System.String" />
65        <Parameter Name="p" Type="System.String" />
66        <Parameter Name="n" Type="System.Int32" />
67      </Parameters>
68      <Docs>
69        <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>
70        <param name="p">A <see cref="T:System.String" /> containing the plural form of the string.</param>
71        <param name="n">
72	  An <see cref="T:System.Int32" /> containing a number that determines
73	  which form of the string to return.
74	  If <paramref name="n" /> is one, the translation for
75	  <paramref name="s" /> is returned; otherwise, the translation for
76	  <paramref name="p" /> is returned.
77	</param>
78        <summary>Returns a native language translation of a text whose form depends on the number passed to the method.</summary>
79        <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>
80        <remarks>
81          <example>
82            <para>The following example demonstrates the use of the
83              <see cref="T:Mono.Unix.Catalog" /> type.  See also:
84              http://www.mono-project.com/Internationalization.</para>
85            <code lang="C#">// File: i18n.cs
86using System;
87using Mono.Unix;
88
89public class i18n
90{
91    public static void Main(string[] argv)
92    {
93        Catalog.Init ("i18n", "./locale");
94        Console.WriteLine (Catalog.GetString ("My name is") + " Enzo");
95        int i = 20;
96        Console.WriteLine (Catalog.GetPluralString ("I'm {0} year old.",
97				    "I'm {0} years old.", i), i);
98    }
99}
100            </code>
101          </example>
102        </remarks>
103      </Docs>
104    </Member>
105    <Member MemberName="GetString">
106      <MemberSignature Language="C#" Value="public static string GetString (string s);" />
107      <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetString(string s) cil managed" />
108      <MemberType>Method</MemberType>
109      <AssemblyInfo>
110        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
111        <AssemblyVersion>2.0.0.0</AssemblyVersion>
112        <AssemblyVersion>4.0.0.0</AssemblyVersion>
113      </AssemblyInfo>
114      <ReturnValue>
115        <ReturnType>System.String</ReturnType>
116      </ReturnValue>
117      <Parameters>
118        <Parameter Name="s" Type="System.String" />
119      </Parameters>
120      <Docs>
121        <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>
122        <summary>Returns a native language translation of the text passed as the parameter.</summary>
123        <returns>The translated string, if found in the catalog, <paramref name="s" /> otherwise.</returns>
124        <remarks>
125          <example>
126            <para>The following example demonstrates the use of the
127              <see cref="T:Mono.Unix.Catalog" /> type.  See also:
128              http://www.mono-project.com/Internationalization.</para>
129            <code lang="C#">// File: i18n.cs
130using System;
131using Mono.Unix;
132
133public class i18n
134{
135    public static void Main(string[] argv)
136    {
137        Catalog.Init ("i18n", "./locale");
138        Console.WriteLine (Catalog.GetString ("My name is") + " Enzo");
139        int i = 20;
140        Console.WriteLine (Catalog.GetPluralString ("I'm {0} year old.",
141				    "I'm {0} years old.", i), i);
142    }
143}
144            </code>
145          </example>
146        </remarks>
147      </Docs>
148    </Member>
149    <Member MemberName="Init">
150      <MemberSignature Language="C#" Value="public static void Init (string package, string localedir);" />
151      <MemberSignature Language="ILAsm" Value=".method public static hidebysig void Init(string package, string localedir) cil managed" />
152      <MemberType>Method</MemberType>
153      <AssemblyInfo>
154        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
155        <AssemblyVersion>2.0.0.0</AssemblyVersion>
156        <AssemblyVersion>4.0.0.0</AssemblyVersion>
157      </AssemblyInfo>
158      <ReturnValue>
159        <ReturnType>System.Void</ReturnType>
160      </ReturnValue>
161      <Parameters>
162        <Parameter Name="package" Type="System.String" />
163        <Parameter Name="localedir" Type="System.String" />
164      </Parameters>
165      <Docs>
166        <param name="package">A <see cref="T:System.String" /> containing the name of the package (domain) that is to be accessed.</param>
167        <param name="localedir">A <see cref="T:System.String" /> containing the top level directory (folder) under which the message catalog(s) are stored.</param>
168        <summary>Initialize the object instance by providing information required to build the base directory where the message catalog is stored.</summary>
169        <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.
170</remarks>
171      </Docs>
172    </Member>
173  </Members>
174</Type>
175