Skip to content

Commit 6af91a0

Browse files
feat: hints (#1066)
* feat: add json5 loader * feat: add jsonc bucket * feat: add pullComments definition * feat: implement pullComments in jsonc * chore: add `CLAUDE.md` * refactor: rename comments into hints * feat: implement pullHints inside flat loader * feat: add hints pulling to `run` cmd * chore: upd examples * feat: add pullHints support to xcstrings * chore: add changesets * chore: exclude `CLAUDE.md` from prettier * chore: fix prettier
1 parent 5b916f4 commit 6af91a0

35 files changed

+1652
-3
lines changed

.changeset/dirty-brooms-burn.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@lingo.dev/_spec": minor
3+
"lingo.dev": minor
4+
---
5+
6+
add hints support for xcode and jsonc buckets

.changeset/new-papayas-hunt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@lingo.dev/_sdk": minor
3+
---
4+
5+
add hints support

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ build/
55
dist/
66
.react-router/
77
.turbo/
8-
.next/
8+
.next/
9+
CLAUDE.md

CLAUDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Extremely important instructions for Claude
2+
3+
## FYI
4+
5+
- We're in a pnpm + turbo monorepo
6+
7+
## Tools
8+
9+
- Must use `pnpm` as package manager
10+
11+
## Testing
12+
13+
- When you add tests - make sure they pass
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
// JSON5 allows comments!
3+
title: "Hello, world!",
4+
description: "A simple demo app with JSON5 features",
5+
version: "1.0.0",
6+
support_email: "[email protected]",
7+
homepage: "https://lingo.dev",
8+
deprecated: null,
9+
empty: "",
10+
emoji: "🚀",
11+
12+
// Unquoted keys are allowed
13+
author: {
14+
name: "John Doe"
15+
},
16+
17+
contributors: [
18+
{ name: "Alice" },
19+
{ name: "Bob" }
20+
],
21+
22+
messages: [
23+
"Welcome to MyApp",
24+
"Hello, world!"
25+
],
26+
27+
config: {
28+
theme: {
29+
primary: "Blue theme"
30+
}
31+
},
32+
33+
mixed_array: [
34+
"Mixed content here",
35+
42,
36+
true,
37+
{
38+
nested_message: "Nested text"
39+
}
40+
],
41+
42+
// Hexadecimal numbers work in JSON5
43+
hex_value: 0xDEADBEEF,
44+
45+
// Trailing commas are allowed
46+
locked_key_1: "This value is locked and should not be changed",
47+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
// JSON5 allows comments!
3+
title: "¡Hola, mundo!",
4+
description: "Una aplicación de demostración simple con características JSON5",
5+
version: "1.0.0",
6+
support_email: "[email protected]",
7+
homepage: "https://lingo.dev",
8+
deprecated: null,
9+
empty: "",
10+
emoji: "🚀",
11+
12+
// Unquoted keys are allowed
13+
author: {
14+
name: "Juan Pérez"
15+
},
16+
17+
contributors: [
18+
{ name: "Alicia" },
19+
{ name: "Roberto" }
20+
],
21+
22+
messages: [
23+
"Bienvenido a MiApp",
24+
"¡Hola, mundo!"
25+
],
26+
27+
config: {
28+
theme: {
29+
primary: "Tema azul"
30+
}
31+
},
32+
33+
mixed_array: [
34+
"Contenido mixto aquí",
35+
42,
36+
true,
37+
{
38+
nested_message: "Texto anidado"
39+
}
40+
],
41+
42+
// Hexadecimal numbers work in JSON5
43+
hex_value: 0xDEADBEEF,
44+
45+
// Trailing commas are allowed
46+
locked_key_1: "This value is locked and should not be changed",
47+
}

packages/cli/demo/json5/i18n.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1.8,
3+
"locale": {
4+
"source": "en",
5+
"targets": [
6+
"es"
7+
]
8+
},
9+
"buckets": {
10+
"json5": {
11+
"include": [
12+
"./[locale]/example.json5"
13+
],
14+
"lockedKeys": ["locked_key_1"]
15+
}
16+
},
17+
"$schema": "https://lingo.dev/schema/i18n.json"
18+
}

packages/cli/demo/json5/i18n.lock

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 1
2+
checksums:
3+
455da9346f4e772000927cd2ff5bb898:
4+
title: 0468579ef2fbc83c9d520c2f2f1c5059
5+
description: 6f4922f45568161a8cdf4ad2299f6d23
6+
version: 54a9e730e88fb16291b852274d433923
7+
support_email: 10627fcc465897af0f5e1bba042685f9
8+
emoji: b328c432cee108a87a92f05258b6a651
9+
author/name: febee8e9ab40b2fe5106d72675228d00
10+
contributors/0/name: e80d4063a32adaad7b0a82b0bcc10551
11+
contributors/1/name: b2bca2fa3c890618e56d07473f26ead3
12+
messages/0: d1c3a9f35e377554a4ccaa467ca26614
13+
messages/1: 0468579ef2fbc83c9d520c2f2f1c5059
14+
config/theme/primary: 7535a3779d6934ea8ecf18f5cb5b93fd
15+
mixed_array/0: 001b5b003d96c133534f5907abffdf77
16+
mixed_array/3/nested_message: 5f0782dfc5993e99890c0475bc295a30
17+
hex_value: a1b2c3d4e5f6789012345678abcdef01
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"key1": "Hello, world!", // This is a comment for key1
3+
"key2": "A simple demo app with JSONC features" /* This is a comment for key2 */,
4+
// This is a comment for key3
5+
"key3": "1.0.0",
6+
/* This is a block comment for key4 */
7+
"key4": "[email protected]",
8+
/*
9+
This is a comment for key5
10+
*/
11+
"key5": "🚀",
12+
// This is a comment for key6
13+
"key6": {
14+
// This is a comment for key7
15+
"key7": "Nested value",
16+
},
17+
// This key is locked and should not be changed
18+
"locked_key_1": "This value is locked and should not be changed",
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"key1": "¡Hola, mundo!",
3+
"key2": "Una aplicación de demostración simple con características JSONC",
4+
"key3": "1.0.0",
5+
"key4": "[email protected]",
6+
"key5": "🚀",
7+
"key6": {
8+
"key7": "Valor anidado"
9+
},
10+
"locked_key_1": "This value is locked and should not be changed"
11+
}

0 commit comments

Comments
 (0)