-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a script to synchronise translations from the English file to the … #72
Conversation
…local files Signed-off-by: Tobia De Koninck <[email protected]>
E.g. the output on #71:
|
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.
I like the idea
sync_translation.py
Outdated
|
||
if __name__ == "__main__": | ||
|
||
with open(os.path.join('_locales', 'en', 'messages.json')) as file: |
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.
maybe use __file__
to make sure the current working directory doesn't interfere
sync_translation.py
Outdated
if f != "en": | ||
stats = synctranslation(enTranslation, os.path.join("_locales", f, "messages.json")) | ||
|
||
if len(stats["added"]) > 0: |
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.
This check isn't needed, since the for
wouldn't loop otherwise.
Signed-off-by: Tobia De Koninck <[email protected]>
@RobinJadoul done 😄 |
sync_translation.py
Outdated
|
||
if target[id]["message"] == base[id]["message"]: | ||
nottranslated.append(id) | ||
print(join(base_path, target_file_name)) |
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.
Too much output this way?
sync_translation.py
Outdated
# You should have received a copy of the GNU General Public License | ||
# along with Keywi. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
# This script synchronises a translated language file with the English one |
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.
This could actually be a docstring, but I guess a comment is fine as well
Signed-off-by: Tobia De Koninck <[email protected]>
…local files
@RobinJadoul what do you think?
If found useful I can add a CI job.