Giter VIP home page Giter VIP logo

Comments (1)

alexisAvenel avatar alexisAvenel commented on July 20, 2024 1

Resolved ! Use i18n file like you and update values.

default-treeview-i18n.ts

import {Injectable} from '@angular/core';
import {I18n} from './i18n';
import {TreeviewI18n, TreeviewItem} from 'ngx-treeview';

@Injectable()
export class DefaultTreeviewI18n extends TreeviewI18n {
    constructor(protected i18n: I18n) {
        super();
    }

    getText(checkededItems: TreeviewItem[], isAll: boolean): string {
        if (isAll) {
            switch (this.i18n.language) {
                case 'en':
                    return 'All';
                case 'fr':
                    return 'Tous';
                default:
                    return 'Tất cả';
            }
        }

        switch (checkededItems.length) {
            case 0:
                switch (this.i18n.language) {
                    case 'en':
                        return 'Select options';
                    case 'fr':
                        return 'Sélectionner des options';
                    default:
                        return 'Chọn mục';
                }
            case 1:
                return checkededItems[0].text;
            default:
                switch (this.i18n.language) {
                    case 'en':
                        return `${checkededItems.length} options selected`;
                    case 'fr':
                        return `${checkededItems.length} options sélectionnées`;
                    default:
                        return `${checkededItems.length} mục đã được chọn`;
                }
        }
    }

    allCheckboxText(): string {
        switch (this.i18n.language) {
            case 'en':
                return 'All';
            case 'fr':
                return 'Tous';
            default:
                return 'Tất cả';
        }
    }

    filterPlaceholder(): string {
        switch (this.i18n.language) {
            case 'en':
                return 'Filter';
            case 'fr':
                return 'Filtrer';
            default:
                return 'Lọc';
        }
    }

    filterNoItemsFoundText(): string {
        switch (this.i18n.language) {
            case 'en':
                return 'No items found';
            case 'fr':
                return 'Aucunes catégories trouvées';
            default:
                return 'Không có mục nào được tìm thấy';
        }
    }

    tooltipCollapseExpand(isCollapse: boolean): string {
        if (isCollapse) {
            switch (this.i18n.language) {
                case 'en':
                    return 'Expand';
                case 'fr':
                    return 'Ouvrir';
                default:
                    return 'Mở rộng';
            }
        } else {
            switch (this.i18n.language) {
                case 'en':
                    return 'Collapse';
                case 'fr':
                    return 'Fermer';
                default:
                    return 'Thu lại';
            }
        }
    }
}

from ngx-treeview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.