Search code examples
javascriptlit

lit web component localization using lit-translate


I am using lit-localization(https://www.npmjs.com/package/lit-translate) to change component language. But all documentations and demos are using typescript.

If anyone have done web component localization using lit-translate, please share it how you did it using javascript. If not what is the solution to localize my web component.

https://github.com/andreasbm/lit-translate


Solution

  • I could solve this issue following this document. using npm dedupe.

    There shouldn't be multiple lit-html maintained inside node_modules folder. runing npm dedupe , it Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree,

    npm ls lit-html

    a
    +-- b <-- depends on c@1.0.x
    |   `-- c@1.0.3
    `-- d <-- depends on c@~1.0.9
        `-- c@1.0.10
    

    npm dedupe

    a
    +-- b
    +-- d
    `-- c@1.0.10
    

    so running npm dedupe solved my issue. Thanks.