// maps from source name to target public string Map(string sourceLocalName, LocaleM targetLocale) { string defaultName = _localToDefaultNameMap[sourceLocalName]; string localName = _defaultNameToLocalMap[new MapKey(defaultName, targetLocale)]; return(localName); }
// maps from source name to target public string Map(string sourceLocalName, LocaleM targetLocale) { if (_localToDefaultNameMap != null && _localToDefaultNameMap.ContainsKey(sourceLocalName)) { string defaultName = _localToDefaultNameMap[sourceLocalName]; var mapKey = new MapKey(); foreach (var key in _defaultNameToLocalMap.Keys .Where(key => key.Key == defaultName && key.Locale == targetLocale)) { mapKey = key; break; } if (_defaultNameToLocalMap.ContainsKey(mapKey)) { var localName = _defaultNameToLocalMap[mapKey]; return(localName); } } return(null); }
// maps from source name to target public string Map(string sourceLocalName, LocaleM targetLocale) { string defaultName = _localToDefaultNameMap[sourceLocalName]; MapKey mapKey = new MapKey(); Dictionary <MapKey, string> .KeyCollection mapKeys = _defaultNameToLocalMap.Keys; foreach (var key in mapKeys) { if (key.Key == defaultName && key.Locale == targetLocale) { mapKey = key; break; } } if (_defaultNameToLocalMap.ContainsKey(mapKey)) { string localName = _defaultNameToLocalMap[mapKey]; return(localName); } return(null); }
public MapKey(string key, LocaleM localeM) { this.Locale = localeM; this.Key = key; }
public void AddMapping(string defaultName, LocaleM locale, string localName) { _localToDefaultNameMap.Add(localName, defaultName); _defaultNameToLocalMap.Add(new MapKey(defaultName, locale), localName); }