Open Closed

Languages in Web.Public #6444


User avatar
0
datdv1 created

Hi Support Team ABP!

ABP Framework version: v7.4.4

UI Type:Angular

Database System: MongoDB

Tiered (for MVC) or Auth Server Separated (for Angular): no

Currently, I am using module web public Razor ASP .Net and running web public normally. However, with localization I implement it by myself and not reuse the server side localization resources.

My team plan to use server side localization like this like: https://docs.abp.io/en/abp/latest/Localization#using-in-a-razor-view-page Could you please guide me how to integrate server side localization to web public Razor ASP .Net and guide for me step by step?


17 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This document already explains the steps in detail.

    https://docs.abp.io/en/abp/latest/Localization#creating-a-localization-resource

    If you get any error, you can continue feedback.

  • User Avatar
    0
    datdv1 created

    Hi maliming!

    Currently, I have modify the web public module, and now entire of this module is my code. So now I need to implement server side localization resources. in this code

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I don't know your exact code, but you just need to create the resources and localize the translations on the server side, and after that you can use them in web.public, which you can see in a new template project.

    If my understanding is wrong, you can share some code to explain your case in detail.

  • User Avatar
    0
    datdv1 created

    Hi maliming!

    Because entire of web public module is modified, I think I will send you my code, Please review my code and give your idea Could you please send me your email?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    liming.ma@volosoft.com

    Please make your project as simple as possible.

    Thanks

  • User Avatar
    0
    datdv1 created

    Hi maliming! I sent to your email.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I downloaded your project, can you share some steps or tips?

  • User Avatar
    0
    datdv1 created

    Hi maliming!

    in my project, we use Language middleware on file src/LogiPlat.Web.Public/Commons/Middlewares/LanguageMiddleware.cs (line 68-69) to fetch language from server

    I dont; want to fetch language from server, I want to inject IHtmlLocalizer to my project, please guide me how to do this

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can inject IHtmlLocalizer, I tested, and it works.

  • User Avatar
    0
    datdv1 created

    Hi maliming!

    let me try and feedback to you. I want to ask a question How can I get all current active language on backend then binding to web public?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can inject ILanguageProvider service to get all languages.

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/ILanguageProvider.cs

  • User Avatar
    0
    datdv1 created

    Hi maliming! Thank you very much! let me try and feedback to you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

  • User Avatar
    0
    datdv1 created

    Hi maliming! I used IHtmlLocalizer, But it cannot change language in my page.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Abp uses an endpoint to change the current language.

    https://localhost:44348/Abp/Languages/Switch?culture=vi&uiCulture=vi&returnUrl=%2F
    

  • User Avatar
    0
    datdv1 created

    Hi maliming! Thank you verymuch

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You're welcome.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09