Skip to content

Commit

Permalink
Merge pull request #399 from athombv/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
RobinBol authored Jun 24, 2024
2 parents 1eabe59 + 5fb4ef5 commit 3107364
Show file tree
Hide file tree
Showing 32 changed files with 4,590 additions and 44 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/apply_locales.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Apply Locales

# About this workflow:
# It is triggered on created pull_requests with changes in the "generated_locales" folder. It will apply the locale files from the "generated_locales" folder and commit the changes to the repository.

# GitHub repo configuration:
# 1. Go to Manage access and add 'Github Actions' team with role: admin.
# 2. If you have protected branches, go to Branches > edit protected branch > enable 'Restrict who can push to
# matching branches' and add the 'athombv/github-actions' team.

# Note: make sure to commit package-lock.json, this is needed for `npm ci`.

on:
pull_request:
paths:
- "generated_locales/**"

jobs:
apply_locales:
name: Apply Locales

# Only run this job if initiator is not the Homey Github Actions Bot to prevent loops
if: github.actor != 'homey-bot'

runs-on: ubuntu-latest
steps:
# Checks out the current repository.
- name: Checkout git repository
uses: actions/checkout@v3
with:
# The token below is only necessary if you want to push the version bump to a protected branch
token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}

# Set git config to reflect Homey Github Actions Bot user
- name: Set up HomeyGithubActionsBot git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "Homey Github Actions Bot"
# Configures a Node.js environment.
- name: Set up node 12 environment
uses: actions/setup-node@v1
with:
node-version: "12"

- name: Install dependencies
run: npm ci

- name: Apply Locales
run: node ./scripts/apply-locale-files.js

- name: Commit and push applied locales
run: |
git add . || echo "No changes due to applying locales."
git commit -m "ci: applied locales" || echo "No changes to commit."
git push origin HEAD:${{ github.event.pull_request.head.ref }}
60 changes: 60 additions & 0 deletions .github/workflows/generate_locales.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Generate Locales

# About this workflow:
# It is triggered on push events to master and develop with changes in the "assets" folder. It will generate locale files from the assets and commit the changes to the repository.

# GitHub repo configuration:
# 1. Go to Manage access and add 'Github Actions' team with role: admin.
# 2. If you have protected branches, go to Branches > edit protected branch > enable 'Restrict who can push to
# matching branches' and add the 'athombv/github-actions' team.

# Note: make sure to commit package-lock.json, this is needed for `npm ci`.

on:
workflow_dispatch:
push:
branches:
- "master"
- "develop"
paths:
- "assets/**"

jobs:
generate_locales:
name: Generate Locales

# Only run this job if initiator is not the Homey Github Actions Bot to prevent loops
if: github.actor != 'homey-bot'

runs-on: ubuntu-latest
steps:
# Checks out the current repository.
- name: Checkout git repository
uses: actions/checkout@v3
with:
# The token below is only necessary if you want to push the version bump to a protected branch
token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}

# Set git config to reflect Homey Github Actions Bot user
- name: Set up HomeyGithubActionsBot git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "Homey Github Actions Bot"
# Configures a Node.js environment.
- name: Set up node 12 environment
uses: actions/setup-node@v1
with:
node-version: "12"

- name: Install dependencies
run: npm ci

- name: Generate Locales
run: node ./scripts/generate-locale-files.js

- name: Commit and push generated locales
run: |
git add . || echo "No changes due to generated locales."
git commit -m "ci: generated locales" || echo "No changes to commit."
git push
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated_locales/*
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ This library can, among other things:


See `/examples/` for how-to usage.

## Translations

This library contains translations in the following files:
- `./assets/app/permissions.json`
- `./assets/capability/capabilities/<capability_id>.json`
- `./assets/device/classes/<device_class_id>.json`

These files are automatically parsed to language specific locale files in `./generated_locales`. The generated locales should not be edited manually, always edit the original files as listed above. Commits to master or develop with changes to the files above will trigger a [GitHub Action](.github/workflows/generate_locales.yml) that [re-generates](scripts/generate-locale-files.js) the locales and commits the result. Incoming PRs with changes to `./generated_locales` will trigger a [GitHub Action](.github/workflows/apply_locales.yml) that [applies](scripts/apply-locale-files.js) the updated generated locales to the files listed above.

> Note: when adding new languages to the files listed above, make sure to add the `./generated_locales/<new_language_code>.json` file manually so that the [script that generates the locales](scripts/generate-locale-files.js) will pick it up.
67 changes: 51 additions & 16 deletions assets/app/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,12 @@
"pattern": {
"type": "string"
},
"highlight": {
"type": "boolean",
"enum": [
true
]
},
"zwave": {
"$ref": "#/definitions/zwaveSetting"
}
Expand Down Expand Up @@ -618,6 +624,12 @@
}
}
},
"highlight": {
"type": "boolean",
"enum": [
true
]
},
"zwave": {
"$ref": "#/definitions/zwaveSetting"
}
Expand Down Expand Up @@ -676,6 +688,12 @@
}
}
},
"highlight": {
"type": "boolean",
"enum": [
true
]
},
"zwave": {
"$ref": "#/definitions/zwaveSetting"
}
Expand Down Expand Up @@ -714,6 +732,12 @@
"value": {
"type": "boolean"
},
"highlight": {
"type": "boolean",
"enum": [
true
]
},
"zwave": {
"$ref": "#/definitions/zwaveSetting"
}
Expand All @@ -739,6 +763,12 @@
"children": {
"$ref": "#/definitions/driverSettings"
},
"highlight": {
"type": "boolean",
"enum": [
true
]
},
"zwave": {
"$ref": "#/definitions/zwaveSetting"
}
Expand All @@ -749,7 +779,10 @@
},
"matterDevice": {
"type": "object",
"required": ["vendorId", "productId"],
"required": [
"vendorId",
"productId"
],
"properties": {
"vendorId": {
"oneOf": [
Expand Down Expand Up @@ -837,8 +870,10 @@
},
"zigbeeDevice": {
"type": "object",
"required": [
"manufacturerName", "productId", "endpoints"
"required": [
"manufacturerName",
"productId",
"endpoints"
],
"properties": {
"manufacturerName": {
Expand Down Expand Up @@ -875,20 +910,20 @@
},
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"clusters": {
"type": "array",
"items": {
"type": "number"
}
},
"bindings": {
"type": "array",
"items": {
"type": "number"
}
"additionalProperties": false,
"properties": {
"clusters": {
"type": "array",
"items": {
"type": "number"
}
},
"bindings": {
"type": "array",
"items": {
"type": "number"
}
}
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions assets/capability/capabilities/alarm_smoke.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"da": "Røgalarm",
"ru": "Сигнал дыма",
"pl": "Alarm przeciwdymny"

},
"desc": {
"en": "True when smoke has been detected",
Expand All @@ -26,7 +25,6 @@
"da": "Sandt, når røg er blevet opdaget",
"ru": "Верно при обнаружении дыма",
"pl": "Adekwatny, kiedy wykryty zostanie dym"

},
"insights": true,
"insightsTitleTrue": {
Expand All @@ -41,7 +39,6 @@
"da": "Røgalarm blev aktiveret",
"ru": "Сигнал дыма включен",
"pl": "Alarm przeciwdymny włączony"

},
"insightsTitleFalse": {
"en": "Smoke alarm turned off",
Expand All @@ -55,7 +52,6 @@
"da": "Røgalarm blev deaktiveret",
"ru": "Сигнал дыма выключен",
"pl": "Alarm przeciwdymny wyłączony"

},
"getable": true,
"setable": false,
Expand All @@ -77,7 +73,6 @@
"da": "Røgalarmen blev aktiveret",
"ru": "Сигнал дыма включен",
"pl": "Alarm przeciwdymny włączony"

}
},
{
Expand All @@ -94,7 +89,6 @@
"da": "Røgalarmen blev deaktiveret",
"ru": "Сигнал дыма выключен",
"pl": "Alarm przeciwdymny wyłączony"

}
}
],
Expand All @@ -113,7 +107,6 @@
"da": "Røgalarmen er !{{tændt|slukket}}",
"ru": "Сигнал дыма !{{вкл.|выкл.}}",
"pl": "Alarm przeciwdymny !{{włączony|wyłączony}}"

}
}
]
Expand Down
2 changes: 1 addition & 1 deletion assets/capability/capabilities/garagedoor_closed.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@
}
]
}
}
}
4 changes: 0 additions & 4 deletions assets/capability/capabilities/light_mode.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"da": "Lystilstand",
"ru": "Режим света",
"pl": "Tryb oświetlenia"

},
"desc": {
"en": "Switch between color or temperature mode",
Expand All @@ -26,7 +25,6 @@
"da": "Skift mellem farve- eller temperaturtilstand",
"ru": "Переключение между цветовым или температурным режимом",
"pl": "Przełączaj między trybem barwy lub temperatury"

},
"values": [
{
Expand All @@ -43,7 +41,6 @@
"da": "Farve",
"ru": "Цвет",
"pl": "Barwa"

}
},
{
Expand All @@ -60,7 +57,6 @@
"da": "Temperatur",
"ru": "Температура",
"pl": "Temperatura"

}
}
],
Expand Down
2 changes: 0 additions & 2 deletions assets/capability/capabilities/light_saturation.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"da": "Farvemætning",
"ru": "Насыщенность цвета",
"pl": "Nasycenie barwy"

},
"min": 0,
"chartType": "stepLine",
Expand All @@ -36,7 +35,6 @@
"da": "Indstil farvemætningen",
"ru": "Установить насыщенность",
"pl": "Ustaw nasycenie"

},
"args": [
{
Expand Down
2 changes: 0 additions & 2 deletions assets/capability/capabilities/measure_gust_angle.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"da": "Vindretning",
"ru": "Угол порывов ветра",
"pl": "Kąt porywu wiatru"

},
"units": {
"en": "°"
Expand All @@ -30,7 +29,6 @@
"da": "Vindretning i grader (°)",
"ru": "Угол порывов ветра в градусах (°)",
"pl": "Kąt porywu wiatru w stopniach (°)"

},
"chartType": "stepLine",
"decimals": 2,
Expand Down
2 changes: 1 addition & 1 deletion assets/capability/capabilities/measure_gust_strength.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
}
]
}
}
}
Loading

0 comments on commit 3107364

Please sign in to comment.