Mercurial > repos > IBBoard
view Lang/ModifiableTranslationSet.cs @ 75:b1ae6fce2e3f
Re #35: Add multi-level cascading of translations
* Add "parent language" property
* Make translation fetching request parent translation if none is found
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 07 Apr 2010 19:34:38 +0000 |
parents | 753be4b6c3b0 |
children | f45d28dc1d6a |
line wrap: on
line source
// This file (TranslationSet.cs) is a part of the IBBoard project and is copyright 2010 IBBoard // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. using System; using System.Collections.Generic; namespace IBBoard.Lang { /// <summary> /// A set of translations in a given language that allow setting of translations as well as getting /// </summary> public class ModifiableTranslationSet : AbstractTranslationSet { private AbstractTranslationSet parentTranslationSet; public ModifiableTranslationSet(string languageCode) : this(languageCode, "") { //Do nothing extra } public ModifiableTranslationSet(string languageCode, string parentLanguageCode) : base(languageCode, parentLanguageCode) { //Do nothing extra } public void SetTranslation(string key, string translation) { translations[key] = translation; } public void SetParentTranslations(ModifiableTranslationSet parentTranslations) { ParentLanguage = parentTranslations.Language; parentTranslationSet = parentTranslations; } protected override AbstractTranslationSet GetParentTranslations() { return parentTranslationSet; } } }