next() Packaged Middleware

    @andrewwormald/i18n-extended

    1.4.2 • Public • Published

    Completing everything that is missing in Angular's i18n package

    logo


    i18n-extended NPM version NPM monthly downloads NPM total downloads

    created by Andrew Wormald
    SwiftySpartan / @andrewwormald

    ####Notes

    Production ready from v1.3.5

    You must install this gloablly to easily execute the command from anywhere without having to use `./node_modules/.bin/i18n-extended` executable

    Installation:

    Step 1:

    Navigate to your angular directory that has all your angular projects.

        npm install -g @andrewwormald/i18n-extended@latest --save
    Step 2:

    You need to run the command in your angular project directory

        i18n-extended 

    If the above doesnt work try the following in your Angular app directory

        ./node_modules/.bin/i18n-extended 
    Step 3:

    Configure i18n-extended service in your app.module.ts file

        import { i18nExtended, I18N_EXTENDED_DATA } from '@andrewwormald/i18n-extended';
        
        // This file is generated at the root of the app
        import { i18nDataMap } from '../../../../i18n.extended.map';
        
        providers: [
            {
              provide: I18N_EXTENDED_DATA,
              useValue: () => i18nDataMap(),
            },
        ]
    Step 4:
        import { i18nExtended } from '@andrewwormald/i18n-extended';
    
       class myComponent {
            title: string;
            
            constructor(private translateService: i18nExtended) {
                // This needs to match the <target-language> attribute value in the .xlf file>
                this.translateService.setLanguage('fr');
            }
            
            myMethod() {
                // Calling `translateText()` will be part of marking the text for extraction
                // as well as fetching the translated text at runtime. If nothing is found or if
                // the text has not yet been translated, the provided text will be returned as is.  
                this.title = this.translateService.translateText('I like i18n-extended!');
            }
       }

    Install

    npm i @andrewwormald/i18n-extended

    DownloadsWeekly Downloads

    3

    Version

    1.4.2

    License

    MIT

    Unpacked Size

    408 kB

    Total Files

    44

    Last publish

    Collaborators

    • andrewwormald