Base solution for your next web application
Open Closed

How to set up global default language? #2407


User avatar
0
goldstar25 created

How to set up global default language?Such as Chinese.


19 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Are you using ASP.NET MVC 5.x or ASP.NET Core version ?

  • User Avatar
    0
    goldstar25 created

    ASP.NET Core version

  • User Avatar
    0
    goldstar25 created

    <cite>ismcagdas: </cite> Hi,

    Are you using ASP.NET MVC 5.x or ASP.NET Core version ?

    ASP.NET Core

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    In ASP.NET Core version, currently it is not possible by default. Please check this issue comment to implement it <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/387#issuecomment-271833997">https://github.com/aspnetzero/aspnet-ze ... -271833997</a>.

    Let us know if you have any problems.

    Thanks.

  • User Avatar
    0
    goldstar25 created

    <cite>ismcagdas: </cite> Hi,

    In ASP.NET Core version, currently it is not possible by default. Please check this issue comment to implement it <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/387#issuecomment-271833997">https://github.com/aspnetzero/aspnet-ze ... -271833997</a>.

    Let us know if you have any problems.

    Thanks.

    In ASP.NET Core version,currently it can't set default language by code?

  • User Avatar
    0
    Ricavir created

    Hi,

    I've purchased my first template yesterday. I'm trying to add french language. I had the same problems described in previous posts. Adding "fr-FR" is not working at all. I was blocked on loading page after login process. So I changed "fr-FR"translations to "fr" only. With that changes, French labels were displayed in application but not on login page by default.

    Therefore, I've tested the workaround mentioned previously (from github) by adding some code on startup to get user id and default language.

    Now, French is working on login page AND on application... but I'm not able to switch languages anymore. When I try to select English language, the page is reloaded in french language. Same with all other languages. It's like application is always fowling back to the default language.

    Do you have a solution ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Ricavir,

    Thanks for finding this problem. I have offered a new solution here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/387#issuecomment-271833997">https://github.com/aspnetzero/aspnet-ze ... -271833997</a>. Please let us know if it does not work for you.

    For your first problem about not able to use French language, there is a know issue caused by ASP.NET Core. See this issue for that <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/25">https://github.com/aspnetzero/aspnet-ze ... /issues/25</a>.

    Thanks.

  • User Avatar
    0
    Ricavir created

    Hi,

    Tks for support. This solution is not working : login page is well displayed but after login into application, the page is blocked with loading animation. This problem occurs when culture is added to "fr" (eg : "fr-FR"). I tried to change abp settings to fr-FR,my XML language file to fr-FR and also update languageList table with fr-FR > still same issue. I had to came back to previous change (therefore, the application is working in French but still not possible to switch to any other language in login page or app page)

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you have a browser console error when you login to system ?

  • User Avatar
    0
    Ricavir created

    By debugging this issue, I noticed that JTable labels were not translated to french (the ones in table footer like "go to page" and "row count"). Starting from that, I had a look to the browser console as you advice and noticed that a 404 error was thrown for file jquery.jtable.en.js. So, I copy/paste jquery.jtable.fr.js and renamed it to jquery.jtable.en.js

    I put back into the code line "app.ConfigureRequestLocalization();" in Startup.cs

    Now, switching languages works again, great !

    But, on JTable footers I have french translations when English language is selected (because of my previous copy/paste from french) and English translations when French is selected => and that is really stranged to me.

    Do you have any hint to fix that ?

  • User Avatar
    0
    Ricavir created

    Ok, the problem is linked with default language. I try to select German as default language. In that configuration, JTable footer translations are... English. And when switching to French language (that is not the default language anymore), JTable footer translations are French as it has to be.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is good that the first problem is solved. About the second problem> "I try to select German as default language. In that configuration, JTable footer translations are... English."

    Can you check application cookies in chrome's developer console ? Please send a screenshot if possible.

    Thanks.

  • User Avatar
    0
    Ricavir created

    Here it is

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks for the screenshot. We will try to fix this.

  • User Avatar
    0
    Ricavir created

    Did you planned to fix this issue ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We have created an issue for this problem <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/67">https://github.com/aspnetzero/aspnet-ze ... /issues/67</a>. Probably, it will be fixed in the next release.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This issue is resolved <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/67">https://github.com/aspnetzero/aspnet-ze ... /issues/67</a>. Can you try it and reopen if it is not solved for you ?

    Thanks

  • User Avatar
    0
    Ricavir created

    I just tried and it works like a charm. Thank you !

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks for your quick feedback :)