Repository navigation
Conversation
| val released = previous != null && previous.timestamp != manifest.timestamp | ||
| if (failed) { | ||
| lastFailure = System.currentTimeMillis() | ||
| if (released) return false |
There was a problem hiding this comment.
If one file in a new release fails every time (a 404, invalid JSON, or something else that keeps failing), this returns before the new manifest is written. The client then stays on the old release. Every reload after RETRY_DELAY refetches the manifest, the same file fails again, and later releases are never adopted until someone fixes that file upstream.
Could we write the new manifest anyway and just skip the files that failed? Since they're cached per release, the next attempt would retry only the missing ones. Another option is to give up on a file after N failures.
| def merge(found): | ||
| for namespace, language, entries in found: | ||
| if language == SOURCE_LANGUAGE: | ||
| sources.setdefault(namespace, {}).update(entries) |
There was a problem hiding this comment.
This merges en_us from every MC version into one source file per namespace, and the newest version wins. At runtime every key in that file is applied, whatever mod version is installed. So if a key's English text changes between versions, the translation can have the wrong placeholders for some installs.
For example, a mod has x.msg = "%s kills" on 1.8.9 and "%s killed %s" on 1.21. The translator writes "%1$s tötete %2$s". On 1.8.9, String.format gets one argument, throws, and Locale shows Format error: ....
We could split sources per MC version (or per mod version). A cheaper fix: at apply time, skip any community value whose placeholder count doesn't match the installed en_us value for that key.
| if (!SAFE_NAME.matches(namespace)) continue | ||
| val languages = listOfNotNull(segments.getOrNull(segments.size - 2), key).map(::normalize) | ||
| for (language in languages.distinct()) { | ||
| if (LANGUAGE_NAME.matches(language)) files.getOrPut(language) { HashMap() }.putIfAbsent(namespace, path) |
There was a problem hiding this comment.
This assumes Crowdin's %locale_with_underscore% (and the content key) is the same as the Minecraft language code. That isn't always true. Crowdin's Norwegian Bokmål exports as nb_NO, while MC uses no_no, so a no_no player never gets anything. The upload side has the same problem: locale_directory("no_no") writes translations/no_NO/, which Crowdin ignores, so mods' existing Norwegian translations are dropped.
A languages_mapping block in crowdin.yml that maps Crowdin locales to MC codes would fix both directions, as long as the runtime uses the same mapping.
| sha1, (path, urls) = item | ||
| data = fetch_verified(urls, sha1) | ||
| if data is None: | ||
| raise RuntimeError(f"failed to download {path}") |
There was a problem hiding this comment.
If one jar still can't be downloaded after the retries, this kills pool.map and the whole sync fails. A single file pulled from Modrinth, or a short CDN outage, would block that week's upload, including OneConfig's own en_us changes.
Could this log a warning and skip the jar, and only fail the job if a large share of the jars couldn't be fetched?
|
Thanks, fixed all four.
|
Sets up Crowdin so we can translate every mod in OneClient, including third-party ones and OneConfig itself. Translations are downloaded at runtime, which means nothing gets committed back to the repo and mods don't need to ship anything new.
How it works
en_us.jsoncomes straight from the repo.en_us.jsonchanges onv1, or when you start it by handoneconfig/translations. The manifest is checked at most every 6 hours, and files are only downloaded again after a new release.Before it's live
CROWDIN_PROJECT_IDandCROWDIN_PERSONAL_TOKENas repo secretsDISTRIBUTION_HASHinCommunityTranslations.kt. It's empty for now, so the runtime part doesn't do anything yet.Changes
extract_mod_sources.py(new): pulls the strings out of the bundle jarscrowdin.yml(new): Crowdin CLI config.github/workflows/crowdin.yml(new): sync and release jobsCommunityTranslations.kt(new): downloads, caches and applies the translationsMixin_CommunityTranslations.java(new): hooks language loading on 1.21.1+Mixin_LegacyCommunityTranslations.java(new): same for 1.8.9OneConfigMixinInit.java: registers the mixinsTested on 26.3, 1.21.1 and 1.8.9 with a local copy of the CDN, before the last round of fixes.