Mono Class Library: Mono.Unix.Catalog Overview | Members

Mono.Unix.Catalog.GetPluralString Method

Returns a native language translation of a text whose form depends on the number passed to the method. [Edit]

public static string GetPluralString (string s, string p, int n)

Parameters

s
A string containing the singular form of the string. It is also used as the key to search the catalog on. [Edit]
p
A string containing the plural form of the string. [Edit]
n
An int containing a number that determines which form of the string to return. If n is one, the translation for s is returned; otherwise, the translation for p is returned. [Edit]

Returns

The translated string. If no message catalog can be found, the method returns the singular form if n == 1, the plural form otherwise. [Edit]

Remarks

The following example demonstrates the use of the Mono.Unix.Catalog type. See also: http://www.mono-project.com/Internationalization.

C# Example
// 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);
    }
}
            
[Edit]

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0