Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Dec 23, 2024
1 parent 3acd535 commit 9f7d1a6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
14 changes: 13 additions & 1 deletion examples/next-international/locales/en.ts
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
export default {} as const;
export default {
hello: "Hello",
welcome: "Hello {name}!",
"about.you": "Hello {name}! You have {age} yo",
"scope.test": "A scope",
"scope.more.test": "A scope",
"scope.more.param": "A scope with {param}",
"scope.more.and.more.test": "A scope",
"scope.more.stars#one": "1 star on GitHub",
"scope.more.stars#other": "{count} stars on GitHub",
"missing.translation.in.fr": "This should work",
"cows#one": "A cow",
} as const;
13 changes: 12 additions & 1 deletion examples/next-international/locales/fr.ts
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
export default {} as const;
export default {
welcome: "Bonjour {name} !",
"about.you": "Bonjour {name} ! Vous avez {age} ans",
"scope.test": "Un domaine",
"scope.more.test": "Un domaine",
"scope.more.param": "Un domaine avec {param}",
"scope.more.and.more.test": "Un domaine",
"scope.more.stars#one": "1 étoile sur GitHub",
"scope.more.stars#other": "{count} étoiles sur GitHub",
"missing.translation.in.fr": "Cela devrait fonctionner",
"cows#one": "Une vache",
} as const;
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@languine/cli",
"version": "0.5.0",
"version": "0.5.1",
"type": "module",
"bin": "dist/index.js",
"main": "dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function extractChangedKeys(diff: string) {
if (line.startsWith("+") && !line.startsWith("+++")) {
// Handle both quoted and unquoted keys
const quotedMatch = line.match(/["']([\w_.#]+)["']/);
const unquotedMatch = line.match(/^[+]\s*(\w+):/);
const unquotedMatch = line.match(/^[+]\s*(\w+):\s*"[^"]*"/);

if (quotedMatch) {
addedKeys.add(quotedMatch[1]);
Expand All @@ -97,7 +97,7 @@ export function extractChangedKeys(diff: string) {
} else if (line.startsWith("-") && !line.startsWith("---")) {
// Handle both quoted and unquoted keys
const quotedMatch = line.match(/["']([\w_.#]+)["']/);
const unquotedMatch = line.match(/^[-]\s*(\w+):/);
const unquotedMatch = line.match(/^[-]\s*(\w+):\s*"[^"]*"/);

if (quotedMatch) {
removedKeys.add(quotedMatch[1]);
Expand Down

0 comments on commit 9f7d1a6

Please sign in to comment.