Conversation
183f1cd
to 760bf0d
Compare
|
It's impossible to build a correct tool to resolve the "tooling issue". If you think yes, please show a feasible solution. |
I think it's purely a algorithm problem, no parallelization is needed ...... |
Yeah, I was just refering to |
Could introduce a prefix to all translations like |
I skimmed through this and if I'm understanding correctly it's looking through all files for each key. something similar in shell (fish but I don't think any specific syntax from it is used). bare in mind it probably is missing keys as it's a quick PoC. rg "TrN? \"([\w._]*)\"" -o --no-filename --no-line-number -r '$1' >keys #find all Tr(N)s from templates
rg "Tr?N\(\"(.*)\"\)" -o --no-filename --no-line-number -r '$1' >> keys # find all Tr(N)s from go files
sort keys | uniq > keys_in_code # sort for comparison
rg "(.*) = .*" options/locale/locale_en-US.ini -N -r '$1' | sort |uniq > keys_in_locale # strip to keys and sort
comm keys_in_locale keys_in_code -32 # list every key in locale which wasn't in code Disregard - this does not take locale being in ini format so it's wrong. |
Another locale tool, backport-locale, is located under the build directory. Therefore, I think it makes sense to keep them together. How about moving the entire build directory under tools, as tools/build? |
improve, now it's about 15s.
Yes. This tool just check unused keys but not check missed keys.
|
When do some translations, I found some keys have never been used. So that I wrote a tool to help to avoid unused language keys.
the tool will search all
.go
(except test go files) or.tmpl
files to find"$key"
to detect whether the language keys are being used. This cannot cover all the situations, i.e. some keys are composited dynamically. So that manually check is necessary. There is a whitelist with glob syntax to manually skip such a situation.