The m17n Library: language.c File Reference

# language.c File Reference

## Functions
MPlist * | mlanguage_list (void)
| List 3-letter language codes.
MSymbol | mlanguage_code (MSymbol language, int len)
| Get a language code.
MPlist * | mlanguage_name_list (MSymbol language, MSymbol target, MSymbol script, MSymbol territory)
| Return the language names written in the specified language.
MText * | mlanguage_text (MSymbol language)
| Return the language name written in that language.
MPlist * | mscript_list (void)
| List script names.
MPlist * | mscript_language_list (MSymbol script)
| List languages that use a specified script.
Obsolete functions
Get an English language name. This function is obsolete. Use mlanguage_name_list() instead. The mlanguage_name() function returns a symbol whose name is an English name of language. language is a symbol whose name is an ISO639-2 3-letter language code, an ISO639-1 2-letter language codes, or an English word. Return value: If the information is available, this function returns a non-Mnil symbol. Otherwise, it returns Mnil. See Also: mlanguage_code(), mlanguage_text().
MSymbol | mlanguage_name (MSymbol language)
## Variables
MSymbol | Miso639_1
MSymbol | Miso639_2

## Function Documentation

MPlist* mlanguage_list | ( | void |  | ) |

List 3-letter language codes.

The mlanguage_list() funciton returns a well-formed plist whose keys are Msymbol and values are symbols whose names are ISO639-2 3-letter language codes.

Return value:
  This function returns a plist. The caller should free it by m17n_object_unref().

See Also:
  mscript_list().

MSymbol mlanguage_code | ( | MSymbol | language,
|  | int | len |
| ) |  |  |

Get a language code.

The mlanguage_code() function returns a symbol whose name is the ISO639 language code of language. language is a symbol whose name is an ISO639-2 3-letter language code, an ISO639-1 2-letter language codes, or an English word.

len specifies the type of the returned language code. If it is 3, an ISO639-2 3-letter language code is returned. If it is 2, an ISO639-1 2-letter language code is returned when defined; otherwise Mnil is returned. If it is 0, a 2-letter code is returned when defined; otherwise a 3-letter code is returned.

Return value:
  If the information is available, this function returns a non-Mnil symbol. Otherwise, it returns Mnil.

See Also:
  mlanguage_name_list(), mlanguage_text().

MPlist* mlanguage_name_list | ( | MSymbol | language,
|  | MSymbol | target,
|  | MSymbol | script,
|  | MSymbol | territory |
| ) |  |  |

Return the language names written in the specified language.

The mlanguage_name_list() function returns a plist of LANGUAGE's names written in TARGET language. SCRIPT and TERRITORY, if not Mnil, specifies which script and territory to concern at first.

LANGUAGE and TARGET must be a symbol whose name is an ISO639-2 3-letter language code or an ISO639-1 2-letter language codes. TARGET may be Mnil, in which case, the language of the current locale is used. If locale is not set or is C, English is used.

SCRIPT and TERRITORY must be a symbol whose name is a script and territory name of a locale (e.g. "TW", "SG") respectively.

Return value:
  If the translation is available, this function returns a non-empty plist. The first element has key MText and the value is an M-text of a translated language name. If the succeeding elements also have key MText, their values are M-texts of alternate translations.

If no translation is available, `NULL` is returned.

The returned plist should not be modified nor freed.

See Also:
  mlanguage_code(), mlanguage_text().

MText* mlanguage_text | ( | MSymbol | language | ) |

Return the language name written in that language.

The mlanguage_text() function returns, in the form of M-text, the language name of language written in language. If the representative characters of the language are known, the characters of the returned M-text has a text property whose key is Mtext and whose value is an M-text that contains the representative characters.

Return value:
  If the information is available, this function returns an M-text that should not be modified nor freed. Otherwise, it returns `NULL`.

See Also:
  mlanguage_code(), mlanguage_name().

MPlist* mscript_list | ( | void |  | ) |

List script names.

The mscript_list() funciton returns a well-formed plist whose keys are Msymbol and values are symbols whose names are script names.

Return value:
  This function returns a plist. The caller should free it by m17n_object_unref().

See Also:
  mscript_language_list(), mlanguage_list().

MPlist* mscript_language_list | ( | MSymbol | script | ) |

List languages that use a specified script.

The mscript_language_list() function lists languages that use script. script is a symbol whose name is the lower-cased version of a script name that appears in the Unicode Character Database.

Return value:

This function returns a well-formed plist whose keys are Msymbol and values are symbols whose names are ISO639-1 2-letter codes (or ISO639-2 3-letter codes, if the former is not available). The caller should not modify nor free it. If the m17n library does not know about script, it returns @ c NULL.

See Also:
  mscript_list(), mlanguage_list().

MSymbol mlanguage_name | ( | MSymbol | language | ) |

## Variable Documentation

MSymbol Miso639_1

MSymbol Miso639_2