Skip to content

Commit 08652e1

Browse files
authored
Add schema validation workflow (#12)
* Add schema validation workflow * Update hash * Only against main
1 parent b29cbdc commit 08652e1

File tree

4 files changed

+75
-46
lines changed

4 files changed

+75
-46
lines changed

Diff for: .github/workflows/validate_schema.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Validate examples against schema
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 0 * * 0' # weekly
10+
11+
jobs:
12+
validate:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
16+
- name: Validate JSON
17+
uses: walbo/validate-json@6a48fa79d27775ab3099cb09cf1d8dfe5c4dcf11
18+
with:
19+
files: example/*.json
20+
schema: schemas/arb.json

Diff for: README.md

+2-26
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,6 @@ In ARB, localizable resources are encoded as a JSON object. Each resource will h
1212
**Example:**
1313

1414
```json
15-
{
16-
"@@locale": "en",
17-
"@@context": "HomePage",
18-
"helloAndWelcome": "Welcome {firstName} {lastName}!",
19-
"@helloAndWelcome": {
20-
"description": "Initial welcome message",
21-
"placeholders": {
22-
"firstName": {
23-
"type": "String"
24-
},
25-
"lastName": {
26-
"type": "String"
27-
}
28-
}
29-
},
30-
"newMessages": "You have {newMessages, plural, =0{No new messages} =1 {One new message} two{Two new Messages} other {{newMessages} new messages}}",
31-
"@newMessages": {
32-
"type": "text",
33-
"description": "Number of new messages in inbox.",
34-
"placeholders": {
35-
"newMessages": {
36-
"type": "int"
37-
}
38-
}
39-
}
40-
}
15+
#TODO: add permalink to embed example in follow up PR
16+
#https://github.com/google/app-resource-bundle/blob/111somehash111/example/simple.arb
4117
```

Diff for: docs/specification.md

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11

22
# Application Resource Bundle Specification
3-
* [Simple, extensible and directly usable](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#simple-extensible-and-directly-usable)
4-
* [Sample resource file](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#sample-resource-file)
5-
* [Resource Id](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#resource-id)
6-
* [Resource Value](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#resource-value)
7-
* [Placeholder in resource](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#placeholder-in-resource)
8-
* [Plural and Gender support](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#plural-and-gender-support)
9-
* [CSS resource](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#css-resource)
10-
* [Resource attributes](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#resource-attributes)
11-
* [Predefined resource attributes](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#predefined-resource-attributes)
12-
* [Global attributes](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#global-attributes)
13-
* [Customized attributes](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#customized-attributes)
14-
* [Resource Linking](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#resource-linking)
15-
* [Verbose and Compact versions of ARB](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#verbose-and-compact-versions-of-arb)
16-
* [ARB namespace and registration](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#arb-namespace-and-registration)
17-
* [Namespace reference with or without variation part](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#namespace-reference-with-or-without-variation-part)
18-
* [ARB file organization](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#arb-file-organization)
19-
* [Using ARB in](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#using-arb-in)
20-
* [Using ARB in HTML](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#using-arb-in-html)
21-
* [Common Mistakes when creating resource in ARB format](https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#common-mistakes-when-creating-resource-in-arb-format)
3+
- [Application Resource Bundle Specification](#application-resource-bundle-specification)
4+
- [Simple, extensible and directly usable](#simple-extensible-and-directly-usable)
5+
- [Sample resource file](#sample-resource-file)
6+
- [Resource Id](#resource-id)
7+
- [Resource Value](#resource-value)
8+
- [Placeholder in resource](#placeholder-in-resource)
9+
- [Plural and Gender support](#plural-and-gender-support)
10+
- [CSS resource](#css-resource)
11+
- [Resource attributes](#resource-attributes)
12+
- [Predefined resource attributes](#predefined-resource-attributes)
13+
- [Global attributes](#global-attributes)
14+
- [Customized attributes](#customized-attributes)
15+
- [Resource Linking](#resource-linking)
16+
- [Verbose and Compact versions of ARB](#verbose-and-compact-versions-of-arb)
17+
- [ARB namespace and registration](#arb-namespace-and-registration)
18+
- [ARB namespace](#arb-namespace)
19+
- [Namespace reference with or without variation part](#namespace-reference-with-or-without-variation-part)
20+
- [ARB file organization](#arb-file-organization)
21+
- [Using ARB in JavaScript](#using-arb-in-javascript)
22+
- [Manipulating ARB Instance](#manipulating-arb-instance)
23+
- [Resource String in ARB](#resource-string-in-arb)
24+
- [Using ARB in HTML](#using-arb-in-html)
25+
- [Text in HTML](#text-in-html)
26+
- [Image in HTML](#image-in-html)
27+
- [CSS](#css)
28+
- [Common Mistakes when creating resource in ARB format](#common-mistakes-when-creating-resource-in-arb-format)
2229

2330
## Simple, extensible and directly usable
2431
Application Resource Bundle (abbr. ARB) is a localization resource format that is simple (based on JSON), extensible (vocabulary can be added without affecting existing tools and usage), and directly usable (applications can access the resource directly from this format without converting to another form).
@@ -421,4 +428,4 @@ CSS is handled the same way as other HTML element. A style element need to be pr
421428
## Common Mistakes when creating resource in ARB format
422429
* Invalid JSON format: the last item in a map/array should not be terminated by comma.
423430
* Invalid JSON format: directional quotation marks (left quotation (“;U+201C) + right quotation (”;U+201D)) are used instead of non-directional quotation marks (";U+0022).
424-
* Attribute not defined in ARB specification must be prefixed by `x-`
431+
* Attribute not defined in ARB specification must be prefixed by `x-`

Diff for: example/simple.arb

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"@@locale": "en",
3+
"@@context": "HomePage",
4+
"helloAndWelcome": "Welcome {firstName} {lastName}!",
5+
"@helloAndWelcome": {
6+
"description": "Initial welcome message",
7+
"placeholders": {
8+
"firstName": {
9+
"type": "String"
10+
},
11+
"lastName": {
12+
"type": "String"
13+
}
14+
}
15+
},
16+
"newMessages": "You have {newMessages, plural, =0{No new messages} =1 {One new message} two{Two new Messages} other {{newMessages} new messages}}",
17+
"@newMessages": {
18+
"type": "text",
19+
"description": "Number of new messages in inbox.",
20+
"placeholders": {
21+
"newMessages": {
22+
"type": "int"
23+
}
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)