Skip to content

Commit

Permalink
ci: validate translation file changes (#589)
Browse files Browse the repository at this point in the history
Adds in a workflow to validate changes made to the translation files
that ensures that the source file remains up-to-date.
  • Loading branch information
KhafraDev authored Apr 16, 2024
1 parent 9d9730c commit dbc97fe
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,28 @@ jobs:
run: |
npm run lint
npm run csslint
- name: Check translation files
if: matrix.os == 'ubuntu-latest' && ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
id: check-translation-files
with:
result-encoding: string
script: |
var fs = require('fs');
var path = require('path');
var { addedDiff: diff } = require('deep-object-diff');
var { inspect } = require('util');
var source = JSON.parse(fs.readFileSync('./translations/source.json'));
var translations = fs.readdirSync('./translations')
.map(f => path.join('./translations', f))
.map(j => ({ path: j, json: JSON.parse(fs.readFileSync(j)) }));
for (var json of translations) {
const added = diff(source, json.json)
if (Object.keys(added).length) {
console.log(inspect(added, undefined, 100, true), json.path)
process.exitCode = 1
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"devDependencies": {
"@biomejs/biome": "^1.4.1",
"@types/lz-string": "^1.3.34",
"deep-object-diff": "^1.1.9",
"dprint": "^0.45.0",
"esbuild": "^0.17.15",
"htmlhint": "^1.1.4",
Expand Down
6 changes: 2 additions & 4 deletions translations/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1828,13 +1828,11 @@
},
"oneMind": {
"name": "",
"description": "",
"effect": ""
"description": ""
},
"wowPass4": {
"name": "",
"description": "",
"effect": ""
"description": ""
},
"blueberries": {
"name": "",
Expand Down
33 changes: 29 additions & 4 deletions translations/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@
"name": "Shameless, Ambrosial Patreon Reminder",
"description": "In every realm, Platonic sells out. +1% Blueberry Generation Speed for every +1% Quarks by the Patreon bonus!",
"effect": "Generous Patreon supporters grant you {{amount}}% more Blueberry Time Generation. If you are not already, consider becoming a Patreon supporter to support development!"
},
"ambrosiaObtainium1": {
"name": "RNG-based Obtainium Booster",
"description": "Gain +0.1% Obtainium per &#9752 Ambrosia Luck!",
"effect": "This module increases Obtainium gain by {{amount}}%!"
},
"ambrosiaOffering1": {
"name": "RNG-based Offering Booster",
"description": "Gain +0.1% Offerings per &#9752 Ambrosia Luck!",
"effect": "This module increases Offering gain by {{amount}}%!"
},
"ambrosiaHyperflux": {
"name": "Hyperfluxed Wow! Cube Industrial Production",
"description": "Gain +1% cubes per level, per level of Platonic Upgrade 4x4 purchased (multiplicative!!!)",
"effect": "This module increases Cubes gain by {{amount}}%!"
}
},
"loadouts": {
Expand Down Expand Up @@ -1370,6 +1385,7 @@
"calculator4": "The PL-AT δ runs at 4,096Hz, which is a huge improvement over previous models. Add attempts refill 4% faster per level! Final level adds 32 additional capacity!",
"calculator5": "The PL-AT Γ model somehow performs more 'powerful' computations, whatever that means. +6 seconds of GQ Export timer per level. +1 capacity every 10 levels, with 6 more at final level!",
"calculator6": "The PL-AT _ model was made by Derpsmith, before he was banished from the industry forever. Gain 1 second of Octeract per usage per level. Final level grants 24 additional capacity!",
"calculator7": "The PL-AT ΩΩ model was made by Derpsmith Ω, before he was banished from the industry forever. Gain 1 second of Blueberry Time per usage per level. Final level grants 48 additional capacity!",
"constantEX": "The merchant has one last trick up its sleeve: It can augment your second constant upgrade to be marginally better, but it'll cost an arm and a leg! Instead of the cap being 10% (or 11% with achievements) it will be raised by 1% per level.",
"powderEX": "Platonic himself gives you 2% better conversion rate on Overflux Orbs to Powder per level. This activates when Orbs expire.",
"chronometer2": "Okay, fine. Here's another +0.6% Ascension Speed per level, stacks multiplicatively with the first upgrade!",
Expand Down Expand Up @@ -1622,6 +1638,9 @@
"hasLevel1": "Automatically buy Platonic Upgrades with each ascension, without spending Obtainium or Offerings, anywhere!",
"default": "Automatically buy Platonic Upgrades with each ascension, without spending Obtainium or Offerings, but only in a Singularity Challenge."
},
"dilatedFiveLeaf": {
"desc": "Increase your base ☘ Ambrosia Luck by <<limegreen|{{percent}}%>>! +1% per perk level."
},
"platSigma": "Code 'add' refills {{counter}}% faster per level per Singularity. Currently: {{current}} (MAX: -60% Cooldown)",
"midasMilleniumAgedGold": "Every use of code `add` gives 0.01 free levels of GQ1 and 0.05 free levels of GQ3.",
"goldenRevolution4": "Every Octeract tick, convert 1 in {{gq}} GQ you would gain in this singularity to your balance automagically!",
Expand All @@ -1635,7 +1654,9 @@
"default": "After Singularity 200, Fast Forwards no longer work! Instead, multiply your GQ gain and divide your GQ buy cost by 3."
},
"skrauQ": "Multiply all Quark Gain by ((Singularity - 179)/20)^2. Currently: {{amt}}... Yes, it's that good.",
"derpSmithsCornucopia": "With blessing from the Derpsmith, every singularity grants +{{counter}}% more Octeracts!"
"derpSmithsCornucopia": "With blessing from the Derpsmith, every singularity grants +{{counter}}% more Octeracts!",
"oneHundredThirtyOne": "Gain <<green|☘ +131>> Ambrosia Luck!",
"twoHundredSixtyNine": "Gain <<green|☘ +269>> Ambrosia Luck!"
},
"toString": {
"noMinimum": "No minimal Singularity to purchase required",
Expand Down Expand Up @@ -2059,6 +2080,7 @@
"derpSmithsCornucopia": "Derpsmith's Cornucopia",
"coolQOLCubes": "Cool Qol Cubes",
"irishAnt": "Irish Ants",
"dilatedFiveLeaf": "Dilated Five Leaf Clover!",
"irishAnt2": "Irish Ants II: Electric Boogaloo",
"overclocked": "Overclocked",
"wowCubeAutomatedShipping": "Wow! Cube Automated Shipping",
Expand All @@ -2072,7 +2094,9 @@
"goldenRevolution4": "Golden Revolution IV",
"octeractMetagenesis": "Octeract Metagenesis",
"immaculateAlchemy": "Immaculate Alchemy",
"skrauQ": "skrauQ"
"skrauQ": "skrauQ",
"twoHundredSixtyNine": "Two Hundred and Sixty Nine!",
"oneHundredThirtyOne": "One Hundred and Thirty One!"
}
},
"general": {
Expand Down Expand Up @@ -3368,10 +3392,11 @@
"add": {
"calculator3": "Thanks to PL-AT Ω you have also gained {{x}} real-life seconds to your Ascension Timer!",
"calculator5": "Thanks to PL-AT Γ you have additionally gained {{x}} real-life seconds to your GQ Export Timer!",
"calculator6": "Finally, thanks to PL-AT _ you have gained {{x}} seconds of Octeract generation!",
"calculator6": "Thanks to PL-AT _ you have gained {{x}} seconds of Octeract generation!",
"calculator7": "Finally, thanks to PL-AT Ω you have gained {{x}} seconds of Blueberry Time Generation!",
"calculatorSolution": "For {{w}} Quarks or nothing: What is {{x}} + {{y}}? The answer is {{z}} according to your calculator.",
"calculatorPrompt": "For {{w}} Quarks or nothing: What is {{x}} + {{y}}?",
"calculatorMaxed": "Your calculator figured out that {{a}} + {{b}} = {{c}} on its own, so you were awarded {{d}} Quarks! {{e}} {{f}} {{g}} {{h}} You have {{i}} uses of Add. You will gain 1 in {{j}} seconds.",
"calculatorMaxed": "Your calculator figured out that {{a}} + {{b}} = {{c}} on its own, so you were awarded {{d}} Quarks! {{e}} {{f}} {{g}} {{h}} {{i}} You have {{j}} uses of Add. You will gain 1 in {{k}} seconds.",
"freeLevel": "Moreover, gain {{x}} free levels of GQ1 and {{y}} free levels of GQ3!!!",
"cancelled": "No worries, you didn't lose any of your uses! Come back later!",
"reward": "You were awarded {{a}} Quarks! {{b}} {{c}} {{d}} You have {{e}} uses of Add. You will gain 1 in {{f}} seconds.",
Expand Down

0 comments on commit dbc97fe

Please sign in to comment.