Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix locale files so yaml parsing won't cause errors #3527

Merged

Conversation

ChunkyProgrammer
Copy link
Member

Try to fix Weblate issue

Pull Request Type

  • Bugfix
  • Other- fixed json linting and added basic yaml linting

Related issue

#3522

Description

Fix locale yaml files so weblate can parse them + add linting for yaml/yml and fix json linting

Testing

yarn run dev with this patch

diff --git a/_scripts/ProcessLocalesPlugin.js b/_scripts/ProcessLocalesPlugin.js
index 58bf5acc..5ac86b24 100644
--- a/_scripts/ProcessLocalesPlugin.js
+++ b/_scripts/ProcessLocalesPlugin.js
@@ -1,4 +1,4 @@
-const { existsSync, readFileSync } = require('fs')
+const { existsSync, readFileSync, readdirSync } = require('fs')
 const { brotliCompress, constants } = require('zlib')
 const { promisify } = require('util')
 const { load: loadYaml } = require('js-yaml')
@@ -72,7 +72,10 @@ class ProcessLocalesPlugin {
   loadLocales() {
     this.locales = []
 
-    const activeLocales = JSON.parse(readFileSync(`${this.inputDir}/activeLocales.json`))
+    const activeLocales = readdirSync(this.inputDir)
+      .filter(e => e.endsWith('.yaml'))
+      .map(e => e.replace('.yaml', ''))
+    // const activeLocales = JSON.parse(readFileSync(`${this.inputDir}/activeLocales.json`))
 
     for (const locale of activeLocales) {
       const contents = readFileSync(`${this.inputDir}/${locale}.yaml`, 'utf-8')

Desktop

  • OS: Windows
  • OS Version: 11
  • FreeTube version: 0.18.0

@github-actions github-actions bot added PR: dependencies Pull requests that update a dependency file PR: waiting for review For PRs that are complete, tested, and ready for review labels May 11, 2023
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 11, 2023 01:40
@FreeTubeBot FreeTubeBot merged commit 68f7b49 into FreeTubeApp:development May 13, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label May 13, 2023
@efb4f5ff-1298-471a-8973-3d47447115dc

issue isnt gone yet, see #3522 (comment)

@ChunkyProgrammer ChunkyProgrammer deleted the try-to-fix-weblate-issue branch August 15, 2023 19:20
@ChunkyProgrammer ChunkyProgrammer mentioned this pull request Oct 17, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants