-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Update translations from Crowdin #4663
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
Conversation
WalkthroughIntroduces a new GitHub Actions step to run the CrowdIn action in the translations upload workflow and adds a new JavaScript module exporting PresetsWebsiteRepo that normalizes a URL and delegates to a superclass constructor. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub Actions
participant CI as Translations Workflow
participant CR as CrowdIn Action
Dev->>GH: Push/Dispatch
GH->>CI: Run workflow
CI->>CI: Existing steps (upload/download)
CI->>CR: Run crowdin/[email protected]
CR-->>CI: Action completes (success/error)
CI-->>GH: Workflow result
sequenceDiagram
autonumber
participant App as Caller
participant PWR as PresetsWebsiteRepo
participant PRI as PresetsRepoIndexed (super)
App->>PWR: new PresetsWebsiteRepo(url, official, name)
rect rgba(200,240,255,0.3)
note right of PWR: URL normalization
PWR->>PWR: trim(url)
PWR->>PWR: ensure trailing '/'
PWR->>PWR: derive urlRaw, urlViewOnline
end
PWR->>PRI: super(urlRaw, urlViewOnline, official, name)
PRI-->>PWR: initialized
PWR-->>App: instance ready
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Preview URL: https://pr4663.betaflight-app-preview.pages.dev |
|
@Kloudz805 this is already covered. There is no need for this change request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
web_configurator_crossconfigurator2.js (1)
4-9: Consider adding URL validation.While the URL normalization logic (trim and ensure trailing slash) is correct, there's no validation to handle edge cases like empty strings or invalid URLs.
Consider adding basic validation:
constructor(url, official, name) { + if (!url || typeof url !== 'string') { + throw new Error('Invalid URL: must be a non-empty string'); + } + let correctUrl = url.trim(); + + if (!correctUrl) { + throw new Error('Invalid URL: URL is empty after trimming'); + } if (!correctUrl.endsWith("/")) { correctUrl += "/"; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/translations-upload.yml(1 hunks)web_configurator_crossconfigurator2.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
web_configurator_crossconfigurator2.js (1)
src/tabs/presets/PresetsRepoIndexed/PresetsRepoIndexed.js (1)
PresetsRepoIndexed(3-140)
🪛 actionlint (1.7.7)
.github/workflows/translations-upload.yml
35-35: could not parse as YAML: yaml: line 35: mapping values are not allowed in this context
(syntax-check)
🪛 ESLint
web_configurator_crossconfigurator2.js
[error] 7-7: Expected indentation of 8 spaces but found 20.
(indent)
[error] 9-9: Expected indentation of 8 spaces but found 20.
(indent)
[error] 11-11: Expected indentation of 8 spaces but found 20.
(indent)
[error] 12-12: Expected indentation of 8 spaces but found 20.
(indent)
[error] 14-14: Expected indentation of 8 spaces but found 20.
(indent)
[error] 15-15: Expected indentation of 4 spaces but found 12.
(indent)
[error] 16-16: Expected indentation of 0 spaces but found 1.
(indent)
🪛 YAMLlint (1.37.1)
.github/workflows/translations-upload.yml
[error] 35-35: syntax error: mapping values are not allowed here
(syntax)
| - name: crowdin-action | ||
| uses: crowdin/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Critical: YAML syntax error prevents workflow execution.
The indentation is incorrect, causing a YAML parsing error. The new step is nested too deeply (14 spaces) when it should be at the job step level (4 spaces).
Additionally, this appears to duplicate the existing crowdin/github-action step at line 22, but with a different version (v1.15.2 vs 1.5.1).
Apply this diff to fix the syntax error:
- - name: crowdin-action
- uses: crowdin/[email protected]
+ - name: crowdin-action
+ uses: crowdin/[email protected]However, please clarify:
- Is this step intended to replace the existing step at line 22, or run as a separate step?
- If separate, what configuration should this step use (missing
with:block)? - Should the version be upgraded for both steps?
🏁 Script executed:
#!/bin/bash
echo "Showing lines 1-60 of the workflow file:"
sed -n '1,60p' .github/workflows/translations-upload.yml | nl -ba
echo
echo "Occurrences of crowdin/github-action:"
rg -n "crowdin/github-action" .github/workflows/translations-upload.ymlLength of output: 218
Correct YAML indentation and clarify duplicate step
The crowdin-action step at lines 35–36 is over-indented (should be at 4 spaces, not 14). Apply:
- - name: crowdin-action
- uses: crowdin/[email protected]
+ - name: crowdin-action
+ uses: crowdin/[email protected]Please clarify:
• Replace the existing step at line 22 or run both?
• If separate, what with: configuration is needed?
• Should both steps use the same version?
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: crowdin-action | |
| uses: crowdin/[email protected] | |
| - name: crowdin-action | |
| uses: crowdin/[email protected] |
🧰 Tools
🪛 actionlint (1.7.7)
35-35: could not parse as YAML: yaml: line 35: mapping values are not allowed in this context
(syntax-check)
🪛 YAMLlint (1.37.1)
[error] 35-35: syntax error: mapping values are not allowed here
(syntax)
🤖 Prompt for AI Agents
In .github/workflows/translations-upload.yml around lines 35–36, the
crowdin-action step is over-indented and appears duplicated; fix the indentation
to align with other steps (4 spaces), then remove or consolidate the duplicate
instead of keeping both: either replace the existing step at line 22 with this
corrected one or merge their responsibilities into a single step. If you must
keep two distinct steps, give each a unique name and provide a full with:
configuration (at minimum Crowdin token/auth, project_id, and files/globs or
upload pattern) for each step so they do different work, and ensure both
reference the same action version (or explicitly state why versions differ).
Ensure the step names, indentation, and with: keys match the repository’s other
workflow conventions.
| import PresetsRepoIndexed from "./PresetsRepoIndexed"; | ||
|
|
||
| export default class PresetsWebsiteRepo extends PresetsRepoIndexed { | ||
| constructor(url, official, name) { | ||
| let correctUrl = url.trim(); | ||
|
|
||
| if (!correctUrl.endsWith("/")) { | ||
| correctUrl += "/"; | ||
| } | ||
|
|
||
| const urlRaw = correctUrl; | ||
| const urlViewOnline = correctUrl; | ||
|
|
||
| super(urlRaw, urlViewOnline, official, name); | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Critical: Inconsistent indentation and questionable file placement.
This file has multiple issues:
-
Indentation: Mixed tabs and spaces with excessive indentation throughout (ESLint flags 7 violations). This will fail linting checks.
-
File location: The file is at the repository root, but similar files (e.g.,
PresetsRepoIndexed.js) are insrc/tabs/presets/. This is inconsistent with the project structure. -
File naming: The name
web_configurator_crossconfigurator2.jsis unusual - the "2" suffix suggests a duplicate or test file, and "crossconfigurator" appears redundant. -
PR scope: This file has no relation to translation updates (the stated PR objective).
Apply this diff to fix indentation:
import PresetsRepoIndexed from "./PresetsRepoIndexed";
-export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
- constructor(url, official, name) {
- let correctUrl = url.trim();
-
- if (!correctUrl.endsWith("/")) {
- correctUrl += "/";
- }
-
- const urlRaw = correctUrl;
- const urlViewOnline = correctUrl;
-
- super(urlRaw, urlViewOnline, official, name);
- }
- }
+export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
+ constructor(url, official, name) {
+ let correctUrl = url.trim();
+
+ if (!correctUrl.endsWith("/")) {
+ correctUrl += "/";
+ }
+
+ const urlRaw = correctUrl;
+ const urlViewOnline = correctUrl;
+
+ super(urlRaw, urlViewOnline, official, name);
+ }
+}Please clarify:
- Is this file intended for this PR, or was it included accidentally?
- What is the correct location and name for this file?
- Should the import path be updated once the file is moved?
🏁 Script executed:
#!/bin/bash
set -e
# Find PresetsRepoIndexed definition and its file path
rg -nP "class\s+PresetsRepoIndexed" -C2 --glob "*.js"
# Locate the file web_configurator_crossconfigurator2.js
fd web_configurator_crossconfigurator2.jsLength of output: 512
Relocate, rename and fix import/indentation for PresetsWebsiteRepo
- Move
web_configurator_crossconfigurator2.jsintosrc/tabs/presets/PresetsWebsiteRepo/PresetsWebsiteRepo.js(removing the_crossconfigurator2suffix). - Update the import to point at the actual class location.
- Apply consistent 4-space indentation (spaces only) as per ESLint.
- Confirm whether this file is intended for this PR (it’s unrelated to translation updates).
-import PresetsRepoIndexed from "./PresetsRepoIndexed";
+import PresetsRepoIndexed from "../PresetsRepoIndexed/PresetsRepoIndexed";
-export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
- constructor(url, official, name) {
- let correctUrl = url.trim();
-
- if (!correctUrl.endsWith("/")) {
- correctUrl += "/";
- }
-
- const urlRaw = correctUrl;
- const urlViewOnline = correctUrl;
-
- super(urlRaw, urlViewOnline, official, name);
- }
-}
+export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
+ constructor(url, official, name) {
+ let correctUrl = url.trim();
+
+ if (!correctUrl.endsWith("/")) {
+ correctUrl += "/";
+ }
+
+ const urlRaw = correctUrl;
+ const urlViewOnline = correctUrl;
+
+ super(urlRaw, urlViewOnline, official, name);
+ }
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import PresetsRepoIndexed from "./PresetsRepoIndexed"; | |
| export default class PresetsWebsiteRepo extends PresetsRepoIndexed { | |
| constructor(url, official, name) { | |
| let correctUrl = url.trim(); | |
| if (!correctUrl.endsWith("/")) { | |
| correctUrl += "/"; | |
| } | |
| const urlRaw = correctUrl; | |
| const urlViewOnline = correctUrl; | |
| super(urlRaw, urlViewOnline, official, name); | |
| } | |
| } | |
| import PresetsRepoIndexed from "../PresetsRepoIndexed/PresetsRepoIndexed"; | |
| export default class PresetsWebsiteRepo extends PresetsRepoIndexed { | |
| constructor(url, official, name) { | |
| let correctUrl = url.trim(); | |
| if (!correctUrl.endsWith("/")) { | |
| correctUrl += "/"; | |
| } | |
| const urlRaw = correctUrl; | |
| const urlViewOnline = correctUrl; | |
| super(urlRaw, urlViewOnline, official, name); | |
| } | |
| } |
🧰 Tools
🪛 ESLint
[error] 7-7: Expected indentation of 8 spaces but found 20.
(indent)
[error] 9-9: Expected indentation of 8 spaces but found 20.
(indent)
[error] 11-11: Expected indentation of 8 spaces but found 20.
(indent)
[error] 12-12: Expected indentation of 8 spaces but found 20.
(indent)
[error] 14-14: Expected indentation of 8 spaces but found 20.
(indent)
[error] 15-15: Expected indentation of 4 spaces but found 12.
(indent)
[error] 16-16: Expected indentation of 0 spaces but found 1.
(indent)
🤖 Prompt for AI Agents
In web_configurator_crossconfigurator2.js (lines 1-16): move and rename the file
to src/tabs/presets/PresetsWebsiteRepo/PresetsWebsiteRepo.js, update the top
import to the correct relative path for PresetsRepoIndexed from the new
location, change the file and default export to PresetsWebsiteRepo (remove the
_crossconfigurator2 suffix), reformat the entire file to use 4-space indentation
(spaces only) and fix inconsistent indentation inside the constructor, and
update any modules that import this file to use the new path/name; finally
confirm with the PR author whether this file belongs in this translation-related
PR and remove it from the PR if it’s unrelated.



"This pull request updates the translations in the Betaflight configurator with the latest changes from Crowdin"
Summary by CodeRabbit
New Features
Chores