Open Closed

Read translation values from a database table #8549


User avatar
0
ungoti created

Hi,

I’ve been trying to follow the explanation on this post but I am having trouble understanding it. https://abp.io/support/questions/8434/How-to-create-custom-localization-provider

The idea here is exactly what I need, i.e I need to read translation values from a database table.

Where do I create these : DynamicLocalizationResourceContributor and DynamicResourceLocalizer ?

Then where do these go? https://abp.io/QA/files/3a16cfbafc5812c078367568082e0394.png

I’m totally confused as how to implement this.

Your help will be appreciated.

  • ABP Framework version: v8.3.0
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace: NA
  • Steps to reproduce the issue: NA

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

    hi

    The DynamicLocalizationResourceContributor and DynamicResourceLocalizer are coming from Language Management.

    Do you have license to download the source code of this module?

  • User Avatar
    0
    ungoti created

    Hi there.

    No I do not have a license to download the source code.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The language management module has this feature (read localization texts from database.)

    You can edit the text in Language Textspage.

    If you need these two files source code. I can share it with you even you don't have a business license.

    send an email to liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I have sent the mail.

  • User Avatar
    0
    ungoti created

    Hi there, Thanks for the files that you sent. you sent me these 2 files: DynamicLocalizationResourceContributor and DynamicResourceLocalizer I was expecting a bit more guidance on how to implement the solution which I described in my initial request.

    I was not able to work out the solution from the files that you sent. I need to implement translation texts for dynamic lookup lists which should be stored in a database table and not in a resource file.

    Kind regards,

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add a DynamicLocalizationResourceContributor to GlobalContributors.

    When you try to localize a key, the GetOrNull will be called. Then, you can read from the database or another store.

    In the Language Management module, we use ILanguageTextRepository to get texts from the database.

Made with ❤️ on ABP v9.1.0-preview. Updated on January 02, 2025, 07:06