Skip to content

Updating pt-BR translations (fixing some existing entries, adding missing ones and removing unused ones as well) #3593

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

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

cassiano
Copy link

This PR synchronizes the pt-BR translation file with the en-US one, by adding missing entries. It also fixes some incorrect translations and updates others with better texts.

Changes:

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named

@cassiano
Copy link
Author

I still see the Test and lint code base Expected — Waiting for status to be reported warning above. I have run the linter and tests locally and everything seems fine. What else needs to be done from my side, please?

@cassiano cassiano changed the title Updating pt-BR translations (fixing some existing entries and adding missing ones) Updating pt-BR translations (fixing some existing entries, adding missing ones and removing unused ones as well) Aug 20, 2025
@raclim
Copy link
Collaborator

raclim commented Aug 21, 2025

I still see the Test and lint code base Expected — Waiting for status to be reported warning above. I have run the linter and tests locally and everything seems fine. What else needs to be done from my side, please?

This is something that is triggered on the maintainer's end, so you're all good! I can run the process now. I'll try to take a closer look at these changes by next week!

@edwin-isensee Since you've provided support on the pt-BR translations for our fundraising banner recently, would you be open to also taking a look at these translations as well? Let me know if you have any questions about this!

@cassiano
Copy link
Author

cassiano commented Aug 21, 2025

During the process of reviewing pt-BR translations I have developed a generic TS script (which should be run under Deno, not Node) which greatly facilitated my work. I will include it here:

p5js_editor_i18n_tools.ts

It is used to automatically analyze the codebase and remove unused entries. It also adds missing entries to any locale.

Let me know if you would like more information about it (and how to use it properly) and I will be glad to help.

Cassiano.

@cassiano
Copy link
Author

cassiano commented Aug 21, 2025

The idea is to run the script initially for the en-US locale, which I assume is the only locale containing all necessary entries. The script will remove any unused entries, by trying to locate them directly in the source code. It actually found 61 unused entries in the en-US file (unless proven contrary):

[
  "About.Learn",
  "AddToCollectionList.AnothersTitle",
  "AddToCollectionSketchList.AnothersTitle",
  "CodemirrorFindAndReplace.Find",
  "Collection.Description",
  "Collection.NumSketches_plural",
  "CollectionList.HeaderCreatedAt_mobile",
  "CollectionList.HeaderNumItems_mobile",
  "CollectionList.HeaderUpdatedAt_mobile",
  "CollectionView.TitleCreate",
  "CollectionView.TitleDefault",
  "Console.Close",
  "Console.Open",
  "CopyableInput.OpenViewTabARIA",
  "Explorer.Files",
  "Feedback.GoToForm",
  "Feedback.GoToGithub",
  "Feedback.ViaGithubDescription",
  "Feedback.ViaGithubHeader",
  "Feedback.ViaGoogleDescription",
  "Feedback.ViaGoogleHeader",
  "KeyboardShortcuts.CodeEditing.FindNextMatch",
  "KeyboardShortcuts.CodeEditing.FindPrevMatch",
  "LoginView.Email",
  "LoginView.Username",
  "MobileDashboardView.Assets",
  "MobileDashboardView.Collections",
  "MobileDashboardView.CreateCollection",
  "MobileDashboardView.CreateSketch",
  "MobileDashboardView.Examples",
  "MobileDashboardView.MyStuff",
  "MobileDashboardView.Sketches",
  "MobilePreferences.Accessibility",
  "MobilePreferences.AccessibleOutput",
  "MobilePreferences.AutocompleteHinter",
  "MobilePreferences.Autosave",
  "MobilePreferences.DarkTheme",
  "MobilePreferences.GeneralSettings",
  "MobilePreferences.HighContrastTheme",
  "MobilePreferences.LightTheme",
  "MobilePreferences.LineNumbers",
  "MobilePreferences.LintWarningSound",
  "MobilePreferences.PlainText",
  "MobilePreferences.Settings",
  "MobilePreferences.Sound",
  "MobilePreferences.TableText",
  "MobilePreferences.Theme",
  "MobilePreferences.UsedScreenReader",
  "MobilePreferences.WordWrap",
  "Nav.Auth.Asset",
  "Nav.Auth.My",
  "Nav.Auth.Welcome",
  "Nav.Lang",
  "NewPasswordView.EmptyPassword",
  "NewPasswordView.PasswordConfirmation",
  "NewPasswordView.PasswordMismatch",
  "Preferences.AddonOffARIA",
  "Preferences.AddonOnARIA",
  "SketchList.HeaderCreatedAt_mobile",
  "SketchList.HeaderUpdatedAt_mobile",
  "SketchList.View"
]

There is only one exception, the SkipLink.PlaySketch entry, which for technical reasons cannot be automatically checked, so it must be placed explicitly as a 3rd parameter (the second parameter below, -, refers to the default en-US locale):

deno --allow-read --allow-write ../p5js_editor_i18n_tools.ts . - SkipLink.PlaySketch

Follows the list of parameters for the script:

  1. p5.js project path.
  2. target locale folder (optional, defaults to 'en-US'). If 3rd parameter is present, supply '-' to use the default value.
  3. comma-separated list of unused key exceptions (optional). Please specify at least SkipLink.PlaySketch.

A new file will be generated in the translations/locales/en-US folder, called translations.reviewed.json. The original file should then be replaced by it, after being renamed to translations.json.

I strongly recommend that you double-check that those entries are in fact unused in the codebase before effectively deleting them.

You can run it now for the remaining locales. For example:

  • deno --allow-read --allow-write ../p5js_editor_i18n_tools.ts . pt-BR SkipLink.PlaySketch
  • deno --allow-read --allow-write ../p5js_editor_i18n_tools.ts . it SkipLink.PlaySketch
  • etc

All entries which require manual translation will be properly generated with a [NEEDS TRANSLATION <full-key>] marker, accompanied by the default english translation. For example:

  "LoginForm": {
    ...
    "Errors": {
      "invalidCredentials": "[NEEDS TRANSLATION - LoginForm.Errors.invalidCredentials] Invalid email or password."
    }
  }

Remaining locales usually miss between 50 and 70 entries, which will require manual translations.

That is it. I hope you find the script useful. Cheers!

@cassiano cassiano force-pushed the updating-ptbr-translations branch from fc53cff to 32453f3 Compare August 22, 2025 03:06
@cassiano cassiano mentioned this pull request Aug 22, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants