Hi, I have updated abp to newest version and now my dictionary provider is not working anymore... The function GetDictionaries is not there anymore and LocalizationDictionaryInfo has less params...Could you please show me the correct code?
public IEnumerable<LocalizationDictionaryInfo> GetDictionaries(string sourceName)
{
var cultures = _cultureService.GetOnlyLanguages().GlobalLanguages.ToList();
var entries = _labelTextService.GetTranslationTexts().TranslationTexts.ToList();
var dictionaries = new List<LocalizationDictionaryInfo>();
foreach (var culture in cultures)
{
var tempInfo = new CultureInfo(culture.IsoCode);
dictionaries.Add(new LocalizationDictionaryInfo(DbLocalizationDictionary.Build(tempInfo, entries),
isDefault: Convert.ToBoolean(culture.DefaultLang)));
}
return dictionaries;
}
I have tried following code and the dictionaries are loaded. But if I change language in my menu, the localization do not swtich to the selected lang? [code][/public void Initialize(string sourceName) { var cultures = _cultureService.GetOnlyLanguages().GlobalLanguages.ToList(); var entries = _labelTextService.GetTranslationTexts().TranslationTexts.ToList();
foreach (var culture in cultures)
{
var tempInfo = new CultureInfo(culture.IsoCode);
if(Dictionaries == null)
Dictionaries = new Dictionary<string, ILocalizationDictionary>();
Dictionaries.Add(tempInfo.ToString(),DbLocalizationDictionary.Build(tempInfo, entries));
}
}code]
4 Answer(s)
-
0
Hi,
Do you have a custom localization source which implements ILocalizationDictionaryProvider?
If so, GetDictionaries changed to Dictionaries property (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp/Localization/Dictionaries/ILocalizationDictionaryProvider.cs">https://github.com/aspnetboilerplate/as ... rovider.cs</a>).
-
0
Hi, I have implemented a custom db localizationsource which was described here a few month ago. I'm using your Language Menu on top of the page! The currentlanguagemenu object is changing but abp.localization.values is not changing values to my selected language anymore. I think everything is correctly filled. Here is my code of my own dictionary provider:
public IDictionary<string, ILocalizationDictionary> Dictionaries { get; set; } public void Initialize(string sourceName) { var cultures = _cultureService.GetOnlyLanguages().GlobalLanguages.ToList(); var entries = _labelTextService.GetTranslationTexts().TranslationTexts.ToList(); foreach (var culture in cultures) { var tempInfo = new CultureInfo(culture.IsoCode); if(Dictionaries == null) Dictionaries = new Dictionary<string, ILocalizationDictionary>(); Dictionaries.Add(tempInfo.ToString(),DbLocalizationDictionary.Build(tempInfo, entries)); } }
-
0
Seems to me, that <a href="~/AbpLocalization/ChangeCulture?cultureName={{language.name}}&returnUrl=@ApplicationPath">{{language.name}}</a> is not working anymore... Have you changed something?
Thanks in advance
-
0
No, ~/AbpLocalization/ChangeCulture... should work as before. Are you getting an error?