1.0.0 • Published 5 years ago
babel-plugin-string-to-lingui v1.0.0
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
- 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:
- In menu:
View -> Command pallete...
>Tasks: Configure Task
Task from tasks.json template
- 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"
}
]
}
- Open command pallete and ask it to open
View -> Command pallete... -> Preferences: Open Keyboard Shortcuts (JSON)
- Add this:
{
"key": "cmd+y",
"command": "workbench.action.tasks.runTask",
"args": "Lingui transform"
}
- Open any file and press cmd+e to apply codemod on file.
- Also you could run
Terminal -> Run task... -> Find in the list "Lingui transform" -> Enter
- Enjoy
1.0.0
5 years ago
0.4.3
5 years ago
0.4.1
5 years ago
0.4.2
5 years ago
0.4.0
5 years ago
0.3.5
5 years ago
0.3.4
5 years ago
0.3.2
5 years ago
0.3.3
5 years ago
0.3.1
5 years ago
0.3.0
5 years ago
0.2.0
5 years ago
0.1.8
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.4
5 years ago
0.1.5
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago