Skip to content

Commit aabb720

Browse files
authored
Merge pull request #19 from PolymerLabs/xliff
Add XLIFF support
2 parents c8539f3 + e6fe897 commit aabb720

34 files changed

+1250
-269
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"plugin:@typescript-eslint/recommended"
99
],
1010
"rules": {
11-
"@typescript-eslint/no-use-before-define": ["error", "nofunc"],
11+
"@typescript-eslint/no-use-before-define": "off",
1212
"@typescript-eslint/explicit-function-return-type": "off",
1313
"semi": "error"
1414
}

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
<!-- ## Unreleased -->
8+
## Unreleased
9+
10+
- Add support for the XLIFF localization interchange format:
11+
https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html
12+
13+
- [BREAKING] Replaced `xlbDir` config file property with `interchange` property.
14+
The interchange format is set with `interchange.format` (currently `xliff` or
15+
`xlb`), and other format-specific configuration is set in that object.
916

1017
## [0.1.2] - 2020-05-09
1118

config.schema.json

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,71 @@
2020
"before"
2121
],
2222
"type": "object"
23+
},
24+
"XlbConfig": {
25+
"additionalProperties": false,
26+
"description": "Parse an XLB XML file. These files contain translations organized using the\nsame message names that we originally requested.\nConfiguration for XLB interchange format.",
27+
"properties": {
28+
"format": {
29+
"enum": [
30+
"xlb"
31+
],
32+
"type": "string"
33+
},
34+
"outputFile": {
35+
"description": "Output path on disk to the XLB XML file that will be created containing all\nmessages extracted from the source. E.g. \"data/localization/en.xlb\".",
36+
"type": "string"
37+
},
38+
"translationsGlob": {
39+
"description": "Glob pattern of XLB XML files to read from disk containing translated\nmessages. E.g. \"data/localization/*.xlb\".\n\nSee https://github.com/isaacs/node-glob#README for valid glob syntax.",
40+
"type": "string"
41+
}
42+
},
43+
"required": [
44+
"format",
45+
"outputFile",
46+
"translationsGlob"
47+
],
48+
"type": "object"
49+
},
50+
"XliffConfig": {
51+
"additionalProperties": false,
52+
"description": "Configuration for XLIFF interchange format.",
53+
"properties": {
54+
"format": {
55+
"enum": [
56+
"xliff"
57+
],
58+
"type": "string"
59+
},
60+
"xliffDir": {
61+
"description": "Directory on disk to read/write .xlf XML files. For each target locale,\nthe file path \"<xliffDir>/<locale>.xlf\" will be used.",
62+
"type": "string"
63+
}
64+
},
65+
"required": [
66+
"format",
67+
"xliffDir"
68+
],
69+
"type": "object"
2370
}
2471
},
2572
"properties": {
2673
"$schema": {
2774
"description": "See https://json-schema.org/understanding-json-schema/reference/schema.html",
2875
"type": "string"
2976
},
77+
"interchange": {
78+
"anyOf": [
79+
{
80+
"$ref": "#/definitions/XlbConfig"
81+
},
82+
{
83+
"$ref": "#/definitions/XliffConfig"
84+
}
85+
],
86+
"description": "Localization interchange format and configuration specific to that format."
87+
},
3088
"patches": {
3189
"additionalProperties": {
3290
"additionalProperties": {
@@ -55,18 +113,14 @@
55113
"tsOut": {
56114
"description": "Required path to the directory where generated TypeScript files will be\nwritten.",
57115
"type": "string"
58-
},
59-
"xlbDir": {
60-
"description": "Required path to the directory where generated XLB files will be written.",
61-
"type": "string"
62116
}
63117
},
64118
"required": [
119+
"interchange",
65120
"sourceLocale",
66121
"targetLocales",
67122
"tsConfig",
68-
"tsOut",
69-
"xlbDir"
123+
"tsOut"
70124
],
71125
"type": "object"
72126
}

0 commit comments

Comments
 (0)