Repository navigation
Read Rails YAML by its root key in check without a config - #107
Merged
Merged
Conversation
- A file named for one locale whose root key names another (sr.yml with sr-Latn:) is checked under its file's locale instead of reporting every key as an orphan - Says once per file which locale it defines - Only when there is no localhero.json and the source YAML is wrapped in the source locale; the base branch is judged the same way - A target whose root key is the source locale is still reported
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes localheroai/localhero-ai#803.
Rails loads a YAML file as the locale its root key names, whatever the file is called.
checktook the locale from the file name, soconfig/locales/sr.ymlstarting withsr-Latn:had every key reported as an orphan (sr-Latn.hello) and every source key as missing. On a clean run over chatwoot/chatwoot that was 986 false orphans, all fromsr.yml,devise.sr.ymlandur_IN.yml(rootur:), and the summary line a first-time user reads was wrong.Without a
localhero.json, check now reads such a file under its file's locale and says so once:Scope
check, and only without alocalhero.json. With a config, check keeps reading files the waytranslatedoes. Shared loaders (files.ts,translation-utils.ts) are untouched;isLanguageis exported fromlocale-detection.ts, nothing else changes there.id:) is left alone.de.ymlstarting withen:) is still reported. Rails would load it as the source language.--changed-onlyaligns base files too, judged by the base's own source files, so a key dropped in a pull request is still flagged as new.Known limits
--format github, findings in a realigned file come without a line number (the line lookup reads the original file). Before this they were all false orphans.ur_IN.ymlis checked asur_IN, not merged intouras Rails does. Pairing files to sources stays filename-based.Verified
"sr-Latn" :root spellings, a comment-only file, a source-locale root, an unwrappedid:namespace, a key dropped under--changed-only, and a base branch whose source was not yet wrapped.--path packages/excalidraw/locales) give the same summary as 0.0.76.