Skip to content

Commit

Permalink
feat: add new package with vue extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Jahren committed Apr 3, 2023
1 parent bdbd6cf commit 100105b
Show file tree
Hide file tree
Showing 19 changed files with 2,810 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
.yalc/
yalc.lock
dist
build

npm-debug.log
yarn-error.log
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = {
".*.js.snap$",
],
coverageReporters: ["lcov", "text"],

globalSetup: "./scripts/jest/setupTimezone.js",
projects: [
{
Expand Down Expand Up @@ -70,6 +69,7 @@ module.exports = {
"<rootDir>/packages/format-json",
"<rootDir>/packages/format-csv",
"<rootDir>/packages/message-utils",
"<rootDir>/packages/extractor-vue",
],
},
],
Expand Down
9 changes: 2 additions & 7 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"version": "4.0.0-next.5",
"packages": [
"packages/*"
],
"packages": ["packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand All @@ -19,10 +17,7 @@
]
},
"publish": {
"allowBranch": [
"main",
"next"
],
"allowBranch": ["main", "next"],
"ignoreChanges": [
"**/CHANGELOG.md",
"**/examples/*",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.42",
"@types/convert-source-map": "^2.0.0",
"@types/glob": "^8.1.0",
"@types/micromatch": "^4.0.1",
"@types/normalize-path": "^3.0.0",
"mock-fs": "^5.2.0",
Expand Down
31 changes: 31 additions & 0 deletions packages/extractor-vue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Vue extractor

This package contains a set of custom extractors that handles Vue files. It supports extracting messages from script and setup scripts as well as limited support for extracting messages from templates.

## Installation

```sh
npm install @lingui/extractor-vue
```

## Usage

This custom extractor requires that you use typescript for your lingui configuration.

```ts
import { vueExtractors } from "@lingui/extractor-vue"
import babel from "@lingui/cli/api/extractors/babel"

const linguiConfig = {
locales: ["en", "nb"],
sourceLocale: "en",
catalogs: [
{
path: "<rootDir>/src/{locale}",
include: ["<rootDir>/src"],
},
],
extractors: [babel, ...vueExtractors],
}
export default linguiConfig
```
43 changes: 43 additions & 0 deletions packages/extractor-vue/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@lingui/extractor-vue",
"version": "4.0.0-next.5",
"description": "Custom vue extractor to be used with CLI tool",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"keywords": [
"cli",
"i18n",
"internationalization",
"i10n",
"localization",
"i9n",
"translation"
],
"repository": "lingui/js-lingui",
"bugs": "https://github.com/lingui/js-lingui/issues",
"license": "MIT",
"author": {
"name": "Christoffer Jahren",
"email": "christoffer@jahren.it"
},
"scripts": {
"build": "rimraf ./dist && unbuild",
"stub": "unbuild --stub"
},
"engines": {
"node": ">=16.0.0"
},
"dependencies": {
"@lingui/cli": "^4.0.0-next.5",
"@lingui/conf": "^4.0.0-next.5",
"@vue/compiler-sfc": "^3.2.47"
},
"devDependencies": {
"@lingui/babel-plugin-extract-messages": "^4.0.0-next.5",
"@vue/compiler-core": "^3.2.47",
"unbuild": "^1.1.2",
"vue": "^3.2.47"
},
"gitHead": "f2961fcb319265b08ddeda3aa2549d104fc4c6d4"
}
Loading

0 comments on commit 100105b

Please sign in to comment.