How do I change the order of languages in abp.localization.languages
I would like English to be a first choice, no offence to anyone language:)
Thanks.
5 Answer(s)
-
0
@vladsd, I think easiest way is to do it on the client side if you only want to change order for abp.localization.languages. You can do it after the ajax request is finished.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
@ismcagdas - i cannot find where those languages are loaded, or you suggest to do it at the app startup?
thanks.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
If you are using angular version, then you can do it here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/94e8ec44a49a22ecb8a09d65954c1d193ad532c6/angular/src/AppPreBootstrap.ts#L139">https://github.com/aspnetzero/aspnet-ze ... ap.ts#L139</a>.
Request to "AbpUserConfiguration/GetAll" returns related scripts.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Here you go, solution, not pretty but works:)
// reorg languages with english first var langs = abp.localization.languages; var languages = []; for (var i = 0; i < langs.length; i++) { var info = langs[i]; if (info.name == 'en') languages.push(info); } for (var i = 0; i < langs.length; i++) { var info = langs[i]; if (info.name != 'en') languages.push(info); } abp.localization.languages = languages;Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
How about:
abp.localization.languages.sort(function (info1, info2) { return info1.name == 'en' ? -1 : info2.name == 'en' ? 1 : 0; });Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)