/// <summary> /// Returns text from given identifier /// </summary> /// <param name="id"></param> /// <returns>Localized string</returns> public string Get(string id) { if (_containers[CurrentLanguage].Contains(id)) { return(_containers[CurrentLanguage].Get(id)); } return(_fallbackLanguage.Get(id)); }
public void Get_WidthParameters_IncorrectID_ReturnsErroredString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); var text = container.Get("wrongtext", "param"); Assert.That(text, Is.EqualTo("**!wrongtext!**")); }
public void Get_WithOneParameter_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test4", "awesome"), Is.EqualTo("Text with one awesome parameter.")); }
public string Get_IncorrectID_ReturnsErroredString(string id) { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); return(container.Get(id)); }
public void Get_WithWrongNumberOfParamters_FormatException() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); container.Get("test1", "wrongparam"); }
public void Get_WithHighParameter_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test8", "icy", "sweet", "and pretty"), Is.EqualTo("Text with high and pretty parameter.")); }
public void Get_WithMixedParameters_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test7", "icy", "sweet", "and pretty"), Is.EqualTo("Text with mixed sweet, and pretty, icy parameters.")); }
public void Get_WithTwoParameters_ReturnsParameterizedString() { var container = new LanguageContainer(SystemLanguage.English, GetLanguageFile()); Assert.That(container.Get("test5", "cool", "and great"), Is.EqualTo("Text with two cool, and great parameters.")); }