Skip to content

Commit

Permalink
Merge e21f461 into 7c5f38f
Browse files Browse the repository at this point in the history
  • Loading branch information
decompil3d authored Jul 26, 2022
2 parents 7c5f38f + e21f461 commit 7fc8e2e
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/translate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
subscriptionKey: '${{ secrets.TRANSLATOR_SUBSCRIPTION_KEY }}'
filePath: './src/localize/languages/en.json'
from: 'en'
to: 'de,es,fr,it,nb,pl,pt'
to: 'de,es,fr,it,nb,nl,pl,pt'
debug: false

- name: Get current branch name
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/validate-loc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Validate localization files
on:
pull_request:
paths:
- 'src/localize/languages/*.json'
jobs:
find-new-languages:
runs-on: ubuntu-latest
outputs:
languages: ${{ steps.get-languages.outputs.result }}
steps:
- name: Get new language(s) being added
id: get-languages
uses: actions/github-script@v6
with:
script: |
const pullInfo = context.issue;
pullInfo.pull_number = pullInfo.number;
delete pullInfo.number;
const files = await github.rest.pulls.listFiles(pullInfo);
const newLanguages = files.data.filter(file => {
if (!file.filename.startsWith('src/localize/languages/')) {
return false;
}
if (file.status !== 'added') {
return false;
}
return true;
});
const langCodes = newLanguages.map(l => l.filename.replace('src/localize/languages/', '').replace('.json', ''));
console.log('New languages added:', langCodes.join(', '));
return langCodes;
validate-added-languages:
needs: find-new-languages
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
language: ${{ fromJSON(needs.find-new-languages.outputs.languages) }}
steps:
- uses: actions/checkout@v3
- name: Ensure src/localize/localize.ts imports new language
env:
LANGUAGE: ${{ matrix.language }}
run: |
grep "^import \* as $LANGUAGE from './languages/$LANGUAGE.json';" src/localize/localize.ts || \
(echo "src/localize/localize.ts does not import $LANGUAGE.json" && exit 1)
- name: Ensure src/localize/localize.ts consumes new language
env:
LANGUAGE: ${{ matrix.language }}
run: |
grep "^\s*$LANGUAGE," src/localize/localize.ts || \
(echo "src/localize/localize.ts does not consume $LANGUAGE in languages variable" && exit 1)
- name: Ensure .github/workflows/translate.yml updated
env:
LANGUAGE: ${{ matrix.language }}
run: |
grep "to: '.*$LANGUAGE" .github/workflows/translate.yml || \
(echo ".github/workflows/translate.yml missing entry for $LANGUAGE" && exit 1)
- name: Ensure cypress/e2e/localization.cy.ts updated
env:
LANGUAGE: ${{ matrix.language }}
run: |
grep "^\s*$LANGUAGE: '" cypress/e2e/localization.cy.ts || \
(echo "cypress/e2e/localization.cy.ts expectedTranslations missing entry for $LANGUAGE" && exit 1)
1 change: 1 addition & 0 deletions cypress/e2e/localization.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Localization', () => {
fr: 'Nuageux',
it: 'Nuvoloso',
nb: 'Skyet',
nl: 'Bewolkt',
pl: 'Pochmurnie',
pt: 'Nublado'
}
Expand Down
41 changes: 41 additions & 0 deletions src/localize/languages/nl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"common": {
"version": "Versie",
"title": "Weer per uur",
"title_card": "Weerkaart per uur",
"description": "Een kaart om de weersomstandigheden per uur weer te geven als een bar.",
"invalid_configuration": "Ongeldige configuratie"
},
"editor": {
"entity": "Entiteit (Verplicht)",
"name": "Naam: (Optioneel)",
"segments_to_show": "Aantal weer te geven prognosesegmenten (Optioneel)",
"offset": "Aantal prognosesegmenten om mee te compenseren (Optioneel)",
"icons": "Pictogrammen weergeven in plaats van tekstlabels",
"label_spacing": "Aantal prognosesegmenten naar ruimtetijd- en temperatuurlabels per (Optioneel)"
},
"errors": {
"missing_entity": "entity ontbreekt in configuratie",
"too_many_segments_requested": "Te veel prognosesegmenten aangevraagd in num_segments. Moet <= aantal segmenten in prognose-entiteit zijn.",
"daily_forecasts": "De geselecteerde weereenheid lijkt dagelijkse voorspellingen te geven. Overweeg om over te stappen naar een uurtarief.",
"must_be_int": "Moet een even geheel getal zijn groter dan of gelijk aan 2",
"invalid_colors": "De volgende kleuren in uw configuratie zijn ongeldig:",
"must_be_positive_int": "Moet een positief geheel getal zijn",
"label_spacing_positive_even_int": "label_spacing moet een even geheel getal zijn groter dan of gelijk aan 2",
"offset_must_be_positive_int": "offset moet een positief geheel getal zijn"
},
"conditions": {
"clear": "Duidelijk",
"cloudy": "Bewolkt",
"fog": "Mist",
"hail": "Hagel",
"thunderstorm": "Onweersbui",
"partlyCloudy": "Half bewolkt",
"heavyRain": "Zware regen",
"rain": "Regenen",
"snow": "Sneeuw",
"mixedPrecip": "Gemengde neerslag",
"sunny": "Zonnig",
"windy": "Winderig"
}
}
2 changes: 2 additions & 0 deletions src/localize/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as es from './languages/es.json';
import * as fr from './languages/fr.json';
import * as it from './languages/it.json';
import * as nb from './languages/nb.json';
import * as nl from './languages/nl.json';
import * as pl from './languages/pl.json';
import * as pt from './languages/pt.json';

Expand All @@ -15,6 +16,7 @@ const languages: any = {
fr,
it,
nb,
nl,
pl,
pt,
};
Expand Down

0 comments on commit 7fc8e2e

Please sign in to comment.