Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

LocalizationDictionary not found anymore when updating ABP #538


User avatar
0
hans abelshausen created

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&lt;string, ILocalizationDictionary&gt;();
            Dictionaries.Add(tempInfo.ToString(),DbLocalizationDictionary.Build(tempInfo, entries));
        }
    }code]

4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    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>).

  • User Avatar
    0
    hans abelshausen created

    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));
                }
            }
    
  • User Avatar
    0
    hans abelshausen created

    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

  • User Avatar
    0
    hikalkan created
    Support Team

    No, ~/AbpLocalization/ChangeCulture... should work as before. Are you getting an error?