private void DelKeyCommand_OnExecute() { ILocalizationKey keyToDelete = SelectedLocalizationKey; MainLanguage.Items.Remove(keyToDelete); SelectedSubLanguage.Items.Remove(SelectedSubLanguage.Items.First((item) => item.Key == keyToDelete.Key)); HasChanges = true; StatusMessage = "Key deleted:" + SelectedSubLocalizationKey.Key; SelectedLocalizationKey = null; }
public string Localize(IUserPreferences userPreferences, ILocalizationKey key, IDictionary <string, object> values) { if (key.Key.Equals(LocalizationKeys.SelectOneForCompletion.Key, StringComparison.OrdinalIgnoreCase)) { return("Select one: "); } if (key.Key.Equals(LocalizationKeys.UnknownCommand.Key, StringComparison.OrdinalIgnoreCase)) { return($"Unknown command: {values.Values.First()}"); } throw new ArgumentException($"Unknown localization key {key.Key}"); }
public override string[] GetKeyValues(ILocalizationKey key) { TranslationKey translationKey = key as TranslationKey; if (translationKey == null) { throw new InvalidCastException("Argument 'key' must be of type TranslationKey to be used in conjunction with 'ClipmobileLocalizationKeyDescriptor'."); } return(new string[] { translationKey.ID.ToString(), translationKey.Language == null ? string.Empty : translationKey.Language.TwoLetterIsoCode, translationKey.Service == null ? string.Empty : translationKey.Service.Name }); }
private void ViewModel_OnSubScrollRequested(object sender, ILocalizationKey e) { if (e == null) { return; } foreach (var item in SubLanguageGrid.Items) { var keyValue = item as ILocalizationKey; if (keyValue.Key == e.Key) { SubLanguageGrid.ScrollIntoView(SubLanguageGrid.Items[SubLanguageGrid.Items.Count - 1]); SubLanguageGrid.UpdateLayout(); SubLanguageGrid.ScrollIntoView(item); break; } } }
public override string[] GetKeyNames(ILocalizationKey key) { //return new string[] { "Product", "Language", "Service" }; return(new string[] { "TranslationKey", "Language", "Service" }); }
public int GetMatchValue(ILocalizationKey key) { TranslationKey other = key as TranslationKey; if (other == null) { return(int.MaxValue); } int matchValue = 4; if (other.Language == null) { if (this.Language != null) { return(int.MaxValue); } matchValue -= 2; } else { if (this.Language != null) { int compare2 = this.Language.ID.CompareTo(other.Language.ID); if (compare2 != 0) { return(int.MaxValue); } matchValue -= 2; } else { matchValue -= 1; } } if (other.Service == null) { if (this.Service != null) { return(int.MaxValue); } matchValue -= 2; } else { if (this.Service != null) { int compare3 = this.Service.ID.CompareTo(other.Service.ID); if (compare3 != 0) { return(int.MaxValue); } matchValue -= 2; } else { matchValue -= 1; } } return(matchValue); }
public string Localize(IUserPreferences userPreferences, ILocalizationKey key, object parameters) { return(_localizationProvider.Localize(userPreferences, key, parameters.GetProperties().ToDictionary())); }
public string Localize(IUserPreferences userPreferences, ILocalizationKey key) { return(_localizationProvider.Localize(userPreferences, key, new Dictionary <string, object>())); }