Transloco: Official docs are not in sync with latest @ngneat/transloco

Created on 12 Feb 2020  ·  11Comments  ·  Source: ngneat/transloco


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Running:

ng add @ngneat/transloco

doesn't create transloco-root.module.ts as the docs say.

It creates transloco.loader.ts and i18 files.

Also:

export declare type TranslocoConfig = {
    defaultLang: string;
    listenToLangChange?: boolean;
    prodMode?: boolean;
    fallbackLang?: string | string[];
    failedRetries?: number;
};

doesn't have availableLangs and some other properties that are stated in the docs.

It's also unclear how to import transloco into lazy loaded modules.

Expected behavior

Keep official docs in sync with latest @ngneat/transloco

Minimal reproduction of the problem with instructions

Run:

ng add @ngneat/transloco

What is the motivation / use case for changing the behavior?

Avoid confusion.

Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.1
Node: 13.8.0
OS: darwin x64

Angular: 9.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.1
@angular-devkit/build-angular     0.900.1
@angular-devkit/build-optimizer   0.900.1
@angular-devkit/build-webpack     0.900.1
@angular-devkit/core              9.0.1
@angular-devkit/schematics        9.0.1
@angular/cli                      9.0.1
@angular/flex-layout              9.0.0-beta.29
@ngtools/webpack                  9.0.1
@schematics/angular               9.0.1
@schematics/update                0.900.1
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Most helpful comment

Look, man, we are all creating issues here, as we bump along the problems using your library. The easiest thing is to close the issue. All I am saying is that I tried all the options that you suggested, and they are not working. Please, keep it cool, I mean you no harm.

All 11 comments

@micobarac there seemed to be a problem with your schematics version could you try to reinstall the lib?
(make sure you install the lastest version)

ng add @ngneat/transloco

added this version to package.json:

"@ngneat/transloco": "1.1.1"

which seems pretty outdated...

@itayod How do I check my schematics version?


~/workspace/openprovider/openprovider-admin-frontend (master)$ ng add @ngneat/transloco
Installing packages for tooling via yarn.
Installed packages for tooling via yarn.
? 🌍 Which languages do you need? en, hr, sr-Latn
? 🔥 Which loader do you want to use? Webpack or HTTP  Http
? 🚀 Which type of translation files you use? Typescript or JSON JSON
? ✍ Which folder will contain the translation files? src/assets/i18n/
CREATE src/assets/i18n/en.json (66 bytes)
CREATE src/assets/i18n/hr.json (66 bytes)
CREATE src/assets/i18n/sr-Latn.json (71 bytes)
CREATE src/app/transloco.loader.ts (529 bytes)
UPDATE src/app/app.module.ts (854 bytes)
~/workspace/openprovider/openprovider-admin-frontend (master)$

      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        }
      }

Why is this issue closed anyway???

It looks like that you must add this:

yarn add @ngneat/transloco

before executing:

ng add @ngneat/transloco

If this is the right way to do it, please update the docs.

@itayod How do I check my schematics version?

I meant the schematic's version of Transloco, simply reinstall Transloco using ng add and it should install the latest version for you (should be 2.13.3).

I tried that, as you can see in my comment above.

ng add @ngneat/transloco

is installing the old 1.1.1 version of transloco. I have no idea why this happens, as I am using the latest Angular 9.

it might be some kind of cache...

Why is this issue closed anyway???

Also, I don't like your tone, it is closed since I released a new version that fixes that

Look, man, we are all creating issues here, as we bump along the problems using your library. The easiest thing is to close the issue. All I am saying is that I tried all the options that you suggested, and they are not working. Please, keep it cool, I mean you no harm.

Anyway, it solved, so install the last version and run ng g @ngneat/transloco:init. That should do the installation process for you

Was this page helpful?
0 / 5 - 0 ratings