Base solution for your next web application
Open Closed

Change Language/Country to en-AU #8183


User avatar
0
bluescopesteel created

Hi,

We are using ASP.NET Core/Angular.

I am struggling to change the locale to en-AU so that on client side dates are in dd/mm/yyyy format. BTW - I am also a bit confused as to why I see code such as the following. It suggests to me that you use Locale and Language interchangeably.

export function shouldLoadLocale(): boolean { return abp.localization.currentLanguage.name && abp.localization.currentLanguage.name !== 'en-US'; }

I have added the language "en-AU" (well its really a locale) on server side.

On client side I cant select that language for some reason using the language dropdown. I can see it there, but when I do select "English (Australia)" the page reloads and it is back to "English". Not "English (Australia)".

So I have tried forcing abp.localization.currentLanguage.name to "en-AU" and I can see that applying to Angular and Moment.

But all the dates are still in US format. For example when I look at the Audit Log there is a date range picker - and that is in US format still (ie mm/dd/yyyy).

What is the simple way for me to add support for "en-AU" and then ensure the UI uses that locale?

Cheers Mark


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can change the default language of the application to en-AU

    https://aspnetboilerplate.com/Pages/Documents/Localization#how-the-current-language-is-determined

  • User Avatar
    0
    bluescopesteel created

    Umm - so how did you do that exactly? Where in the code did you set the default language to "en-AU"? Afterall that was my question - how do I do it?

  • User Avatar
    0
    bluescopesteel created

    Ps. I am not the only one having difficulty working out where/how to do it. See https://stackoverflow.com/questions/48179508/change-default-culture-in-aspnetboilerplate

    So for now I have just did what this fellow did and changed it directly in the database. But where/how do I do that in the code?

    Im aware of this: await SettingManager.ChangeSettingForApplicationAsync(LocalizationSettingNames.DefaultLanguage, "en-AU");

    But have no idea where to put it.

  • User Avatar
    0
    maliming created
    Support Team

    You can change the default seed data of the application.

    Or you can change it in the database.(in AbpSettings table)

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.