Skip to content

Locale: An Extension for Manual Translations - #2389

Draft
ScratchFakemon wants to merge 64 commits into
TurboWarp:masterfrom
ScratchFakemon:Locale
Draft

ScratchFakemon wants to merge 64 commits into
TurboWarp:masterfrom
ScratchFakemon:Locale

Conversation

@ScratchFakemon

Copy link
Copy Markdown
Contributor

Locale is an extension for registering manual translations. This is useful if you want real, human-created translations instead of simple machine ones that the Translate extension provides. This isn't the most feature-filled extension and it didn't take too long to make, so there may be weird bugs or problems.

@github-actions github-actions Bot added the pr: new extension Pull requests that add a new extension label Jan 17, 2026
@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

!format

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

Ignore the random commits about temp files and changing the deployment branch, the former were for creating the folder on GitHub web and the latter were so I could preview the gallery with these changes (which didn't end up working). These were reverted.

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

I'm working on a block for getting the user's language code as opposed to the Translate extension's language name feature, just need to actually figure out how to get the TurboWarp language

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

!format

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

Eslint warnings are because of the format changing comment positions, 1 sec

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

grr

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

FINALLY

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

Before I forget, I'll update image attributions

@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

wow im so glad my markdown didnt trigger a type warning

@ScratchFakemon
ScratchFakemon marked this pull request as draft January 19, 2026 02:32
@ScratchFakemon

ScratchFakemon commented Jan 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Things to eventually get done

Last updated: January 19, 2026
These are in chronological order of when I wanted them done.
  • Add blocks for converting between language codes and names (likely with a large lookup table): (name of language code [es v]) and (code of language named [Spanish v])
  • Add a proper list of languages for the above blocks to call
  • Allow any translation of a language's name to be used in codeFromName, similarly to the Translate extension
  • Add documentation
  • Update documentation

pid-j and others added 3 commits September 2, 2026 21:12
Change locale code function to use `Scratch.vm.getLocale()` (as well as a few other things)

Tysm @pid-j
@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

!format

DangoCat and others added 2 commits September 2, 2026 22:02
…erly

The biggest thing is that, instead of completely giving up if the language name/code translation table fails to load, the user is asked for consent to try again. I haven't been able to fully test everything yet but I'll still get the commit out here so other people can test in areas that I wouldn't think about
Comment thread extensions/Fakemon/Locale.js Outdated
Comment thread extensions/Fakemon/Locale.js Outdated
Comment thread extensions/Fakemon/Locale.js Outdated
@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

i made the same commit twice since i thought it didnt work but i guess it did

Comment thread extensions/Fakemon/Locale.js Outdated
Comment thread extensions/Fakemon/Locale.js
Comment thread extensions/Fakemon/Locale.js Outdated
Comment thread extensions/Fakemon/Locale.js Outdated
@GarboMuffin

Copy link
Copy Markdown
Member

Sorry for letting you drag on for months on this. I don't think this is mergeable...

the biggest upside of making an extension in this space should be to give an easy way to manage the strings across languages. such as, perhaps, a nice UI to do the translating by hand, import/export buttons that work with the formats that real translation problems use, but as is, everyone using this is still practically forced to write JSON. am i missing something?

you can, of course, continue to use and develop this yourself though

@GarboMuffin

GarboMuffin commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

other things that would be useful to consider but are not present

  • a story for placeholder replacement
  • a story for advanced placeholder replacement with support for the pluralization formats used by real translation platforms and ways to safely do multi-placeholder substituion with arbitrary text content not being able to break other placeholders
  • the UI should warn when it detects a language does not have matching placeholders
  • try to auto-generate a first-pass translation via normal translate extension (actually, various reasons why this shouldn't be done, at least not via trampoline, but it's an idea of the kind of UI enhancement that would make a large difference compared to the status quo)

@ScratchFakemon

ScratchFakemon commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

If you still want to see if I can get this to a mergeable state, I could probably make some of the changes you suggested
(or i could just work on it for myself)

Planned

  • UI for translating (probably just a modal)
  • Import/Export feature (different translation formats)
  • Placeholders
    • Simple placeholders (just replacing things with other things: I have {apples} apples where apples is 3 returns I have 3 apples)—placeholder translate [I have {apples} apples] to [lang] with [{"apples": 3}])
    • Advanced/Expressional placeholders (more complex things: something like I have {apples} {apples == 1 ? "apple" : "apples"} where apples is 1 would return I have 1 apple instead of I have 1 apples—This should NOT treat the expression between brackets as JavaScript code)
    • Placeholder checking (making sure a translation has the proper placeholders)

@ScratchFakemon
ScratchFakemon marked this pull request as draft September 26, 2026 03:19
@ScratchFakemon

Copy link
Copy Markdown
Contributor Author

Converted to draft since I'm working on major changes

Right now, I'm working on the expression parser for placeholders, but that's gonna take a lot of time and effort to get right since I don't know a lot about expressions sooooooooo...

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: new extension Pull requests that add a new extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants