Open Closed

How to Add a Custom “Create Language Text” Button in the Language Texts Page (ABP Suite) #10015


User avatar
0
Vipinthachinari created

Hi team,

I’m using ABP Framework v8.0.4 with an ABP Suite–generated application, and I’m working with the Language Management → Language Texts page. By default, this view allows us to edit existing texts but doesn’t provide a direct button to create a new language text entry. I’d like to add a custom “Create Language Text” button (for example, in the toolbar of the Language Texts table) that will open a modal or a new page to enter the following details manually:

Resource Name(Dropdown) Culture Name(Dropdown) Name (key) Value

After submission, it should call the backend API (PUT /api/language-management/language-texts) to create or update the text dynamically using ILanguageTextAppService.UpdateAsync().

Could you please guide me on: The recommended way to extend or customize the Language Texts page in an ABP Suite app? How to inject a new toolbar button and open a modal dialog or redirected to a create page with input fields ? Whether there’s an existing ABP component or helper for LanguageText creation that I can reuse?

Environment: ABP Framework Version: 8.3.4 UI Framework: MVC (Razor Pages) Tiered: Yes Database: SQL Server

Expected Outcome: A “Create” button (similar to other ABP entity pages) on the Language Texts list page that allows adding a new translation text manually and saves it using the existing Language Management APIs.


3 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To add a custom "Create Language Text" button to the Language Texts page in your ABP MVC (Razor Pages) application, follow these steps:

    1. Extend the Page Toolbar with a Custom Button

    In your Web module's ConfigureServices method, use the ABP Page Toolbar Extensions to add a new button to the Language Texts page toolbar:

    Configure<AbpPageToolbarOptions>(options =>
    {
        options.Configure<Volo.Abp.LanguageManagement.Web.Pages.LanguageManagement.LanguageTexts.IndexModel>(toolbar =>
        {
            toolbar.AddButton(
                LocalizableString.Create<YourResource>("CreateLanguageText"),
                icon: "plus",
                id: "CreateLanguageTextButton",
                type: AbpButtonType.Primary
            );
        });
    });
    
    • Add the "CreateLanguageText" string to your localization files.
    1. Add the Modal or Redirect Logic
    • In your Index.cshtml (or the corresponding Razor Page), add JavaScript to handle the button click. You can use ABP's modal helpers or redirect to a custom create page.

    Example for opening a modal (using Bootstrap/ABP modal):

    $(function () {
        $('#CreateLanguageTextButton').click(function () {
            abp.modals.open({
                title: 'Create Language Text',
                size: 'lg',
                bodyUrl: '/LanguageManagement/LanguageTexts/CreateModal'
            });
        });
    });
    
    1. Create the Modal or Create Page
    • Add a new Razor Page (e.g., CreateModal.cshtml) under /Pages/LanguageManagement/LanguageTexts/.
    • The page should contain a form with fields: Resource Name (dropdown), Culture Name (dropdown), Name (key), and Value.
    • On form submission, call the backend API (PUT /api/language-management/language-texts) using AJAX or ABP's form helpers.

    Example form (simplified):

    <form id="createLanguageTextForm">
        <!-- Resource Name dropdown -->
        <!-- Culture Name dropdown -->
        <!-- Name (key) input -->
        <!-- Value input -->
        <button type="submit" class="btn btn-primary">Save</button>
    </form>
    <script>
        $('#createLanguageTextForm').submit(function (e) {
            e.preventDefault();
            // Collect form data
            // Call the API using abp.ajax or $.ajax
        });
    </script>
    
    1. Backend API Usage
    • Use ILanguageTextAppService.UpdateAsync() in your backend to create or update the language text.
    • The API endpoint is already available in ABP Language Management module.
    1. Reusable Components
    • There is no built-in ABP modal for creating language texts, but you can reuse ABP's form and modal helpers for consistency.
    • For reference on converting modals to pages or customizing modals, see the community article below.

    Sources:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    Vipinthachinari created

    When I use the above code, it creates a button on the /Pages/LanguageManagement view, which is used to create a new language. However, the below code creates a button on the /Pages/LanguageManagement/Texts page:

        Configure&lt;AbpPageToolbarOptions&gt;(options =>
        {
            options.Configure&lt;Volo.Abp.LanguageManagement.Pages.LanguageManagement.Texts.IndexModel&gt;(toolbar =>
            {
                toolbar.AddButton(
                    LocalizableString.Create&lt;QueuingSystemAppResource&gt;("CreateLanguageText"),
                    icon: "plus",
                    id: "CreateLanguageTextButton",
                    type: AbpButtonType.Primary
                );
            });
        });
    

    Since the application is created using ABP Suite, there is no visible /Pages/LanguageManagement/Texts/Index.cshtml file in the web project. So, where should I place the button click and related logic?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add a custom JavaScript file to the wwwroot folder and add it to typeof(Volo.Abp.LanguageManagement.Pages.LanguageManagement.Texts.IndexModel).FullName bundle

    See https://abp.io/docs/latest/framework/ui/mvc-razor-pages/bundling-minification#configuring-an-existing-bundle

    Thanks.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 20, 2025, 13:25