如何翻译“没有要显示的行”; Ag-Grid中的消息? [英] How To translate "No Rows To Show" message in ag-grid?

查看:320
本文介绍了如何翻译“没有要显示的行”; Ag-Grid中的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据用户选择的语言在ag-grid
中翻译无行显示消息?

How to translate "No Rows To Show" message in ag-grid based on the user selected language?

我有点累了。 / p>

I tired something like this.

gridOptions: GridOptions = <GridOptions> {
        rowSelection: 'single',
        enableColResize: true,
        enableSorting: true,
        enableFilter: true,
        suppressCellSelection: true,

        overlayNoRowsTemplate: '<span style="padding: 10px; border: 2px solid #444; background: lightgoldenrodyellow;">'+.......+'</span>'
    };

我需要在该位置添加一些东西。

I need to add some thing at that .... place.

推荐答案

根据国际化部分,您应该可以像这样在gridOptions中指定该值:

According to the internationalization section you should be able to just specify this value into the gridOptions like so:

gridOptions: GridOptions = <GridOptions> {
        rowSelection: 'single',
        enableColResize: true,
        enableSorting: true,
        enableFilter: true,
        suppressCellSelection: true,

        localeText: {noRowsToShow: 'No hay nada'}
    };

一般来说,这是如何为农业电网解决I18N问题。

That is in general how to tackle I18N for ag-grid.

更具体地讲,您要根据用户选择的语言来控制此行为,您将不得不做更多这样的事情(我假设您有一些已设置包含所选语言的变量):

More specifically to what you asked in regards to how to control this behavoir based on user selected language you would have to do something more like this (I am assuming you have some variable already set up that holds the selected language):

function internationalization (){
    return selectedLanguageVariable === 'es'/*or whatever code you use for spanish*/ ? {noRowsToShow: 'No hay nada'} : {noRowsToShow: 'No Rows'}
}

gridOptions: GridOptions = <GridOptions> {
    rowSelection: 'single',
    enableColResize: true,
    enableSorting: true,
    enableFilter: true,
    suppressCellSelection: true,

    localeText: internationalization()
};

这篇关于如何翻译“没有要显示的行”; Ag-Grid中的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆