Skip to content

Commit

Permalink
fix: Using 3 letter ISO639 language codes (#173)
Browse files Browse the repository at this point in the history
* fix: Using 3 letter ISO639 language codes

* fix: Various PR comments resolved

* fix: Typo and schemas path priority
  • Loading branch information
jlacivita authored Aug 31, 2023
1 parent 6c1487b commit b341dee
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"validate:each": "npx firebolt-openrpc validate --input src/openrpc --schemas node_modules/@firebolt-js/schemas/src/schemas --schemas src/schemas --transformations",
"validate:compiled": "npx firebolt-openrpc validate --input dist/firebolt-open-rpc.json && npm run validate --workspaces",
"validate": "npm run validate:each && npm run validate:compiled ",
"compile": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --output ./dist/firebolt-open-rpc.json --schemas src/schemas --schemas node_modules/@firebolt-js/schemas/src/schemas",
"compile": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --output ./dist/firebolt-open-rpc.json --schemas node_modules/@firebolt-js/schemas/src/schemas --schemas src/schemas",
"slice": "npm run slice --workspaces",
"sdks": "npm run sdk --workspaces",
"docs": "npm run docs --workspaces",
Expand Down
12 changes: 10 additions & 2 deletions src/openrpc/accessibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
"textAlignVertical": "middle",
"windowColor": "white",
"windowOpacity": 50
}
},
"preferredLanguages": [
"eng",
"spa"
]
}
}
}
Expand Down Expand Up @@ -100,7 +104,11 @@
"textAlignVertical": "middle",
"windowColor": "white",
"windowOpacity": 50
}
},
"preferredLanguages": [
"eng",
"spa"
]
}
}
}
Expand Down
50 changes: 50 additions & 0 deletions src/openrpc/closed_captions.json
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,56 @@
}
}
]
},
{
"name": "preferredLanguages",
"summary": "A prioritized list of ISO 639-2/B codes for the preferred closed captions languages on this device.",
"params": [],
"tags": [
{
"name": "property"
},
{
"name": "capabilities",
"x-uses": [
"xrn:firebolt:capability:accessibility:closedcaptions"
]
}
],
"result": {
"name": "languages",
"summary": "the preferred closed captions languages",
"schema": {
"type": "array",
"items": {
"$ref": "https://meta.comcast.com/firebolt/localization#/definitions/ISO639_2Language"
}
}
},
"examples": [
{
"name": "Default Example",
"params": [],
"result": {
"name": "Default Result",
"value": [
"spa",
"eng"
]
}
},
{
"name": "Default Example #2",
"params": [],
"result": {
"name": "Default Result",
"value": [
"eng",
"spa"
]
}
}
]
}
],
"components": {
Expand Down
13 changes: 9 additions & 4 deletions src/openrpc/localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
]
}
],
"summary": "Get the ISO 3166 code for the counrty device is located in",
"summary": "Get the ISO 3166-1 alpha-2 code for the country device is located in",
"params": [],
"result": {
"name": "code",
Expand Down Expand Up @@ -132,6 +132,11 @@
"summary": "Get the ISO 639 1/2 code for the preferred language",
"params": [],
"tags": [
{
"name": "deprecated",
"x-since": "0.17.0",
"x-alternative": "Localization.locale"
},
{
"name": "property"
},
Expand Down Expand Up @@ -189,7 +194,7 @@
"schema": {
"type": "array",
"items": {
"type": "string"
"$ref": "https://meta.comcast.com/firebolt/localization#/definitions/ISO639_2Language"
}
}
},
Expand All @@ -199,15 +204,15 @@
"params": [],
"result": {
"name": "Default Result",
"value": ["es", "en"]
"value": ["spa", "eng"]
}
},
{
"name": "Default Example #2",
"params": [],
"result": {
"name": "Default Result",
"value": ["en", "es"]
"value": ["eng", "spa"]
}
}
]
Expand Down
12 changes: 11 additions & 1 deletion src/schemas/accessibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
},
"styles": {
"$ref": "#/definitions/ClosedCaptionsStyles"
},
"preferredLanguages": {
"type": "array",
"items": {
"$ref": "https://meta.comcast.com/firebolt/localization#/definitions/ISO639_2Language"
}
}
},
"examples": [
Expand All @@ -109,7 +115,11 @@
"textAlignVertical": "middle",
"windowColor": "white",
"windowOpacity": 50
}
},
"preferredLanguages": [
"eng",
"spa"
]
}
]
},
Expand Down
46 changes: 46 additions & 0 deletions src/schemas/localization.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$id": "https://meta.comcast.com/firebolt/localization",
"title": "Localization",
"oneOf": [
{
"$ref": "#/definitions/Locality"
},
{
"$ref": "#/definitions/CountryCode"
},
{
"$ref": "#/definitions/Language"
},
{
"$ref": "#/definitions/Locale"
},
{
"$ref": "#/definitions/TimeZone"
}
],
"definitions": {
"CountryCode": {
"type": "string",
"pattern": "^[A-Z]{2}$"
},
"Language": {
"type": "string",
"pattern": "^[A-Za-z]{2}$"
},
"ISO639_2Language": {
"type": "string",
"pattern": "^[a-z]{3}$"
},
"Locality": {
"type": "string"
},
"Locale": {
"type": "string",
"pattern": "^[a-zA-Z]+([a-zA-Z0-9\\-]*)$"
},
"TimeZone": {
"type": "string",
"pattern": "^[-+_\/ A-Za-z 0-9]*$"
}
}
}

0 comments on commit b341dee

Please sign in to comment.