1.0.0 • Published 4 years ago

babel-plugin-string-to-lingui v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

babel-plugin-string-to-lingui

It's codemod for updating strings/jsxText/templates to 'lingui' and i18n

Usage

Install babel-codemod npm i -g babel-codemod

Then install in root of your project yarn add babel-plugin-string-to-lingui

You could run it:

codemod --plugin ./node_modules/babel-plugin-string-to-lingui/src/index.js app/scripts/pages

Also, you could run it with prettier

codemod --plugin ./node_modules/babel-plugin-string-to-lingui/src/index.js app/scripts/pages --printer prettier

Remove babel-plugin-string-to-lingui from package.json

If there is any issues, let me know in the issues tab here at GitHub.

Limitations

  1. Do not convert '<' and '>' correctly

Integration with VS Code to do file by file

Preconditions:

npm i -g @babel/core babel-codemod babel-plugin-string-to-lingui

VS Code:

  1. In menu: View -> Command pallete...
  2. >Tasks: Configure Task
  3. Task from tasks.json template
  4. Copy and paste this:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Lingui transform",
            "type": "shell",
            "command": "codemod -p /usr/local/lib/node_modules/babel-plugin-string-to-lingui/src/index.js ${file} --printer prettier"
        }
    ]
}
  1. Open command pallete and ask it to open View -> Command pallete... -> Preferences: Open Keyboard Shortcuts (JSON)
  2. Add this:
    {
        "key": "cmd+y",
        "command": "workbench.action.tasks.runTask",
        "args": "Lingui transform"
    }
  1. Open any file and press cmd+e to apply codemod on file.
  2. Also you could run Terminal -> Run task... -> Find in the list "Lingui transform" -> Enter
  3. Enjoy
1.0.0

4 years ago

0.4.3

4 years ago

0.4.1

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.2

4 years ago

0.3.3

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago