| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- using System;
- using System.Runtime.CompilerServices;
- namespace BansheeEngine
- {
- /// <summary>
- /// Manages string tables used for localizing text. Allows you to add and remove different tables and change the
- /// active language.
- /// </summary>
- public sealed class StringTables
- {
- /// <summary>
- /// Currently active language that determines the translations retrieved from localized strings.
- /// </summary>
- public Language ActiveLanguage
- {
- get
- {
- Language value;
- Internal_GetActiveLanguage(out value);
- return value;
- }
- set
- {
- Internal_SetActiveLanguage(value);
- }
- }
- /// <summary>
- /// Returns the string table with the specified id. If the table doesn't exist new one is created.
- /// </summary>
- /// <param name="id">Identifier of the string table.</param>
- /// <returns>String table with the specified identifier.</returns>
- public StringTable GetTable(int id)
- {
- return Internal_GetTable(id);
- }
- /// <summary>
- /// Registers a new string table or replaces an old one at the specified id.
- /// </summary>
- /// <param name="id">Id of the string table to add/replace.</param>
- /// <param name="table">New string table to assign to the specified identifier.</param>
- public void RegisterTable(int id, StringTable table)
- {
- Internal_SetTable(id, table);
- }
- /// <summary>
- /// Removes the string table with the specified id.
- /// </summary>
- /// <param name="id">Identifier of the table to remove.</param>
- public void UnregisterTable(int id)
- {
- Internal_RemoveTable(id);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_GetActiveLanguage(out Language value);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetActiveLanguage(Language value);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern StringTable Internal_GetTable(int id);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_SetTable(int id, StringTable table);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_RemoveTable(int id);
- }
- /// <summary>
- /// A set of all languages that localized strings can be translated to. Loosely based on ISO 639-1 two letter language
- /// codes.
- /// </summary>
- public enum Language
- {
- Afar,
- Abkhazian,
- Avestan,
- Afrikaans,
- Akan,
- Amharic,
- Aragonese,
- Arabic,
- Assamese,
- Avaric,
- Aymara,
- Azerbaijani,
- Bashkir,
- Belarusian,
- Bulgarian,
- Bihari,
- Bislama,
- Bambara,
- Bengali,
- Tibetan,
- Breton,
- Bosnian,
- Catalan,
- Chechen,
- Chamorro,
- Corsican,
- Cree,
- Czech,
- ChurchSlavic,
- Chuvash,
- Welsh,
- Danish,
- German,
- Maldivian,
- Bhutani,
- Ewe,
- Greek,
- EnglishUK,
- EnglishUS,
- Esperanto,
- Spanish,
- Estonian,
- Basque,
- Persian,
- Fulah,
- Finnish,
- Fijian,
- Faroese,
- French,
- WesternFrisian,
- Irish,
- ScottishGaelic,
- Galician,
- Guarani,
- Gujarati,
- Manx,
- Hausa,
- Hebrew,
- Hindi,
- HiriMotu,
- Croatian,
- Haitian,
- Hungarian,
- Armenian,
- Herero,
- Interlingua,
- Indonesian,
- Interlingue,
- Igbo,
- SichuanYi,
- Inupiak,
- Ido,
- Icelandic,
- Italian,
- Inuktitut,
- Japanese,
- Javanese,
- Georgian,
- Kongo,
- Kikuyu,
- Kuanyama,
- Kazakh,
- Kalaallisut,
- Cambodian,
- Kannada,
- Korean,
- Kanuri,
- Kashmiri,
- Kurdish,
- Komi,
- Cornish,
- Kirghiz,
- Latin,
- Luxembourgish,
- Ganda,
- Limburgish,
- Lingala,
- Laotian,
- Lithuanian,
- LubaKatanga,
- Latvian,
- Malagasy,
- Marshallese,
- Maori,
- Macedonian,
- Malayalam,
- Mongolian,
- Moldavian,
- Marathi,
- Malay,
- Maltese,
- Burmese,
- Nauru,
- NorwegianBokmal,
- Ndebele,
- Nepali,
- Ndonga,
- Dutch,
- NorwegianNynorsk,
- Norwegian,
- Navaho,
- Nyanja,
- Provençal,
- Ojibwa,
- Oromo,
- Oriya,
- Ossetic,
- Punjabi,
- Pali,
- Polish,
- Pushto,
- Portuguese,
- Quechua,
- Romansh,
- Kirundi,
- Romanian,
- Russian,
- Kinyarwanda,
- Sanskrit,
- Sardinian,
- Sindhi,
- NorthernSami,
- Sangro,
- Sinhalese,
- Slovak,
- Slovenian,
- Samoan,
- Shona,
- Somali,
- Albanian,
- Serbian,
- Swati,
- Sesotho,
- Sundanese,
- Swedish,
- Swahili,
- Tamil,
- Telugu,
- Tajik,
- Thai,
- Tigrinya,
- Turkmen,
- Tagalog,
- Setswana,
- Tonga,
- Turkish,
- Tsonga,
- Tatar,
- Twi,
- Tahitian,
- Uighur,
- Ukrainian,
- Urdu,
- Uzbek,
- Venda,
- Vietnamese,
- Volapuk,
- Walloon,
- Wolof,
- Xhosa,
- Yiddish,
- Yoruba,
- Zhuang,
- Chinese,
- Zulu,
- Count // Number of entries
- };
- }
|