valor-software / ng2-table

Simple table extension with sorting, filtering, paging... for Angular2 apps
http://valor-software.github.io/ng2-table/
MIT License
553 stars 336 forks source link

How use the i18n in this component? #598

Open sobrito opened 6 years ago

sobrito commented 6 years ago

I am using the ngx-translate/core, how is possível translate the header and the placeholder?

Pingolus commented 5 years ago

Inside component or service :

this.translate.instant(key);

(translate is an instance of TranslateService from @ngx-translate/core)

Just call this method when cols are declared ; for titles and placeholders.

To translate pagination inside component html :

    <pagination *ngIf="config.paging"
                firstText="{{ 'yourTranslateKey' | translate }}"
                nextText="{{ 'yourTranslateKey' | translate }}"
                previousText="{{ 'yourTranslateKey' | translate }}"
                lastText="{{ 'yourTranslateKey' | translate }}"
                ...>
    </pagination>