-
Notifications
You must be signed in to change notification settings - Fork 89
Add script for finding missing translations across all locales #469
Conversation
return {} | ||
|
||
if __name__ == '__main__': | ||
all_locales = ('no', 'se', 'en-IN') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to test, but should include all locales.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to import that from all available locales in our repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point – I'll add that
Also note that the front end trims the spacing from the keys of the translation files. |
What if we rather run this as part of our GitHub workflow? And verify that all the locales on the current branch all contains the same keys? Or would that work against its purpose? |
Yeah, maybe nice to have warnings when you push to a repo or something. |
Ah good catch! So it removes all whitespace, or simply trims redundant whitespace? |
It basically does this: Lines 31 to 44 in b1ca9f3
|
Nice! I'll steal that line. I've opened a new PR where this script is written in JS instead: #481 |
The script is heavily commented with what I've been thinking. There might be a logical error here, so please read through the script to see if it makes sense.
This script will produce false positives (since it looks at all changes to the file ever). Why did I make it like that? Because translations are added at different points in time – a new feature branch will contain new translations, while all the existing branches and locales will be missing those.
This will produce some false positives (translations which have been removed etc.), but it in turn include translations which are being worked on right now in different branches (which should allow us to start translating before the PR is done, and widen the bottleneck which is currently halting PRs). We could also just add the false positives to an ignore list to make them go away.
I'm hoping this should make it easier for us to quickly grab all missing translations for all locales and then handing them off to a non-technical person that don't know JSON or git, maybe via. a more friendly medium like Google Sheets.
This is what I get if I run the script right now for
no
,en-IN
andse
.no missing translation for: Sweden
basically means that the norwegian locale (no.json
) has never had a row in its JSON file where the key isSweden
and the value isSverige
.Does this make sense? Haha, I'm actually not sure. Here's the full output: