Skip to content

Commit

Permalink
Merge branch 'next' into add_new_lingui_vue
Browse files Browse the repository at this point in the history
  • Loading branch information
timofei-iatsenko committed Sep 23, 2024
2 parents 0b55212 + 927c319 commit bd50953
Show file tree
Hide file tree
Showing 51 changed files with 453 additions and 200 deletions.
1 change: 1 addition & 0 deletions .github/verdaccio/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
listen: 0.0.0.0:4873
auth:
auth-memory:
users:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ["16", "18", "19", "20"]
node: ["20", "22"]
os: [ubuntu-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-node@v4
with:
always-auth: true
node-version: 16
node-version: 'lts/*'
cache: 'yarn'

- name: Install dependencies if needed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: andresz1/size-limit-action@v1
- uses: andresz1/size-limit-action@v1.8.0
with:
build_script: release:build
github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"postinstall": "yarn stub:all"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"devDependencies": {
"@babel/preset-env": "^7.20.2",
Expand All @@ -46,7 +46,7 @@
"@tsd/typescript": "^4.9.5",
"@types/jest": "^29.4.0",
"@types/mock-fs": "^4.13.1",
"@types/node": "16.18.13",
"@types/node": "20.14.8",
"@types/ramda": "^0.27.23",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-extract-messages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"devDependencies": {
"@babel/core": "^7.21.0",
Expand Down
12 changes: 11 additions & 1 deletion packages/babel-plugin-lingui-macro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
"types": "./dist/macro.d.mts",
"default": "./dist/macro.mjs"
}
},
"./ast": {
"require": {
"types": "./dist/ast.d.cts",
"default": "./dist/ast.cjs"
},
"import": {
"types": "./dist/ast.d.mts",
"default": "./dist/ast.mjs"
}
}
},
"files": [
Expand All @@ -68,7 +78,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"dependencies": {
"@babel/core": "^7.20.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-lingui-macro/src/macroJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class MacroJs {
_property.key.name = "_"
_property.value.name = uniqTIdentifier.name

return newNode
return t.callExpression(t.identifier(this.useLinguiImportName), [])
}

private createI18nCall(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"build": "rimraf ./dist && tsc -p tsconfig.build.json"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lingui-compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if (require.main === module) {
return previousRun
}

let debounceTimer: NodeJS.Timer
let debounceTimer: NodeJS.Timeout

const dispatchCompile = () => {
// Skip debouncing if not enabled
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lingui-extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ if (require.main === module) {
}

const changedPaths = new Set<string>()
let debounceTimer: NodeJS.Timer
let debounceTimer: NodeJS.Timeout
let previousExtract = Promise.resolve(true)
const dispatchExtract = (filePath?: string[]) => {
// Skip debouncing if not enabled but still chain them so no racing issue
Expand Down
2 changes: 1 addition & 1 deletion packages/conf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"scripts": {
"build": "rimraf ./dist && unbuild",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"exports": {
".": {
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,16 @@ describe("I18n", () => {
expect(missing).toHaveBeenCalledWith("en", "missing")
})
})

it("._ should parse unicode sequences even if the same string goes twice in a row", () => {
const messages = {
"Software development": "Software\\u00ADentwicklung",
}
const i18n = setupI18n({
locale: "de",
messages: { de: messages },
})
expect(i18n._("Software development")).toEqual("Software­entwicklung")
expect(i18n._("Software development")).toEqual("Software­entwicklung")
})
})
10 changes: 10 additions & 0 deletions packages/core/src/interpolate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,14 @@ describe("interpolate", () => {
"Hey Joeª!"
)
})

it("should not crash on a unicode sequences if the same string goes twice in a row", () => {
const cache = compile("Hey {name}!")
expect(interpolate(cache, "en", [])({ name: "Joe\\xaa" })).toEqual(
"Hey Joeª!"
)
expect(interpolate(cache, "en", [])({ name: "Joe\\xaa" })).toEqual(
"Hey Joeª!"
)
})
})
2 changes: 1 addition & 1 deletion packages/core/src/interpolate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isString } from "./essentials"
import { unraw } from "unraw"
import { CompiledIcuChoices } from "@lingui/message-utils/compileMessage"

export const UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g
export const UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/

const OCTOTHORPE_PH = "%__lingui_octothorpe__%"

Expand Down
2 changes: 1 addition & 1 deletion packages/detect-locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"exports": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion packages/extractor-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"stub": "unbuild --stub"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/format-csv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/format-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/format-po-gettext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/format-po/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-mocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=10.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion packages/macro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"exports": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion packages/message-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"README.md",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"exports": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"exports": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "https://github.com/lingui/js-lingui/issues"
},
"engines": {
"node": ">=16.0.0"
"node": ">=20.0.0"
},
"files": [
"LICENSE",
Expand Down
5 changes: 4 additions & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{ "source": "/tutorials/setup-cra", "destination": "/tutorials/setup-react", "permanent": true},
{ "source": "/ref/message-format", "destination": "/guides/message-format", "permanent": true},
{ "source": "/tutorials/extractor-vue", "destination": "/ref/extractor-vue", "permanent": true},
{ "source": "/tutorials/cli", "destination": "/ref/cli", "permanent": true}
{ "source": "/tutorials/cli", "destination": "/ref/cli", "permanent": true},
{ "source": "/guides/flow", "destination": "/ref/conf#flow", "permanent": true},
{ "source": "/guides/excluding-build-files", "destination": "/ref/cli#compile", "permanent": true},
{ "source": "/tutorials/explicit-vs-generated-ids", "destination": "/guides/explicit-vs-generated-ids", "permanent": true}
]
}
2 changes: 2 additions & 0 deletions website/blog/2023-04-26-announcing-lingui-4.0/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ This version is packed with tons of new features, improvements and fixes that wi

The codebase has also been significantly refactored and updated. As a result, Lingui has become much more stable, lightweight, reliable, and less fragile.

<!--truncate-->

### Extractors

The big change in v4.0 is in the extractor internals. It is now less fragile and doesn't depend on host project settings. Also, the extractor now supports TypeScript out of the box.
Expand Down
2 changes: 2 additions & 0 deletions website/blog/2023-12-12-4k-stars/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ image: ./img/social-card.png

We're thrilled to announce that the [Lingui repository](https://github.com/lingui/js-lingui) has reached an important milestone - **4,000** stars! This achievement is a testament to the growing popularity of Lingui as a powerful and flexible internationalization solution for global products.

<!--truncate-->

### Lingui has been gaining traction in the JS community due to its several key advantages {#advantages}

- **Universal** - use it everywhere: Vanilla JS, React, Vue.js, Next.js, Node.js, etc.
Expand Down
13 changes: 0 additions & 13 deletions website/docs/guides/excluding-build-files.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Choosing between generated and explicit IDs
description: Learn about the differences between explicit and generated IDs and how to choose the right approach for your project
---

# Choosing between generated and explicit IDs
# Explicit vs Generated IDs

When internationalizing your application, you may need to decide whether to use explicit or generated IDs for your messages.

In this guide, we will explore the fundamental concepts of explicit and generated IDs, and then delve into a comprehensive comparison, highlighting the benefits and drawbacks of each approach.

Expand Down
11 changes: 0 additions & 11 deletions website/docs/guides/flow.md

This file was deleted.

2 changes: 2 additions & 0 deletions website/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Internationalization Framework for Global Products
description: Lingui is a universal, clean and readable, lightweight and powerful internationalization framework for global projects
---

# Introduction

📖 A readable, automated, and optimized (3 kb) internationalization for JavaScript

> **Internationalization** is the design and development of a product, application or document content that enables easy **localization** for target audiences that vary in culture, region, or language.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/misc/showroom.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Feel free to [send a PR](https://github.com/lingui/js-lingui/issues/new) to list your project here.

- [Bluesky](https://bsky.app/) ([source](https://github.com/bluesky-social/social-app))
- [Fider](https://fider.io/) ([source](https://github.com/getfider/fider))
- [Uniswap Labs Interface](https://app.uniswap.org/) ([source](https://github.com/Uniswap/interface))
- [Flood](https://flood.js.org/) ([source](https://github.com/jesec/flood))
- [Lenster](https://lenster.xyz/) ([source](https://github.com/lensterxyz/lenster))
- [Ansible AWX](https://github.com/ansible/awx) ([source](https://github.com/ansible/awx))
Expand Down
Loading

0 comments on commit bd50953

Please sign in to comment.