Skip to content

Commit

Permalink
Merge branch 'main' into add-color-changing-for-inline-annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhaeberle authored Apr 30, 2024
2 parents 2e4b301 + 35adc1e commit be5aedc
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .changeset/small-mayflies-care.md

This file was deleted.

6 changes: 6 additions & 0 deletions inlang/source-code/ide-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# inlang-vs-code-extension

## 1.40.0

### Minor Changes

- 1cfdca2: add ability to disable inline annotations

## 1.39.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion inlang/source-code/ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/opral/monorepo.git"
},
"icon": "assets/sherlock-logo.png",
"version": "1.39.8",
"version": "1.40.0",
"engines": {
"vscode": "^1.84.2"
},
Expand Down
6 changes: 6 additions & 0 deletions inlang/source-code/plugins/inlang-message-format/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @inlang/plugin-message-format

## 2.2.0

### Minor Changes

- 732430d: Error on messages file json parse failures

## 2.1.1

### Patch Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inlang/plugin-message-format",
"version": "2.1.1",
"version": "2.2.0",
"type": "module",
"exports": {
"./storage-schema": "./src/storageSchema.ts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,46 @@ test("don't throw if the storage path does not exist. instead, create the file a
}
})

test("throws if json has a trailing comma", async () => {
const { plugin } = await import("./plugin.js")
const fs = createNodeishMemoryFs()

const settings = {
sourceLanguageTag: "en",
languageTags: ["en", "de"],
modules: [],
[pluginId]: { pathPattern: "./messages/{languageTag}.json" } satisfies PluginSettings,
}

const enInitial = JSON.stringify({
$schema: "https://inlang.com/schema/inlang-message-format",
first_message: "If this works I will be sad",
second_message: "Let's see if this blows up",
} satisfies StorageSchema)

let deInitial = JSON.stringify({
$schema: "https://inlang.com/schema/inlang-message-format",
second_message: "Mal sehen ob das knallt",
} satisfies StorageSchema)

// inject trailing comma
deInitial = deInitial.slice(0, -1) + ",}"

await fs.mkdir("./messages")
await fs.writeFile("./messages/en.json", enInitial)
await fs.writeFile("./messages/de.json", deInitial)

try {
await plugin.loadMessages!({
settings,
nodeishFs: fs,
})
throw new Error("loadMessages should have thrown")
} catch (e) {
expect((e as Error).message).not.toBe("loadMessages should have thrown")
}
})

test("recursively creating a directory should not fail if a subpath already exists", async () => {
const { plugin } = await import("./plugin.js")
const fs = createNodeishMemoryFs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ export const plugin: Plugin<{
result[key] = parseMessage({ key, value: json[key], languageTag: tag })
}
}
} catch {
// file does not exist. likely, no translations for the file exist yet.
} catch (error) {
// ignore if file does not exist => no translations exist yet.
if ((error as any)?.code !== "ENOENT") {
throw error
}
}
}
return Object.values(result)
Expand Down
7 changes: 7 additions & 0 deletions inlang/source-code/server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

### Patch Changes

- Updated dependencies [732430d]
- @inlang/plugin-message-format@2.2.0

## null

### Patch Changes

- @inlang/plugin-message-format@2.1.1
- @inlang/website@null
- @inlang/badge@0.7.18
Expand Down

0 comments on commit be5aedc

Please sign in to comment.