Skip to content
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

Merged
merged 3 commits into from
Sep 5, 2017

Conversation

LEDfan
Copy link
Owner

@LEDfan LEDfan commented Sep 4, 2017

…local files

@RobinJadoul what do you think?

If found useful I can add a CI job.

@LEDfan LEDfan added this to the 1.0.0 milestone Sep 4, 2017
@LEDfan
Copy link
Owner Author

LEDfan commented Sep 4, 2017

E.g. the output on #71:

[zh_CN] Added              initSSFailed
[zh_CN] Needs translation  initSSFailed

Copy link
Collaborator

@RobinJadoul RobinJadoul left a 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


if __name__ == "__main__":

with open(os.path.join('_locales', 'en', 'messages.json')) as file:
Copy link
Collaborator

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

if f != "en":
stats = synctranslation(enTranslation, os.path.join("_locales", f, "messages.json"))

if len(stats["added"]) > 0:
Copy link
Collaborator

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.

@Riajyuu Riajyuu mentioned this pull request Sep 4, 2017
@LEDfan
Copy link
Owner Author

LEDfan commented Sep 5, 2017

@RobinJadoul done 😄

@RobinJadoul RobinJadoul changed the title Add a script to synchronise translations from the Englis file to the … Add a script to synchronise translations from the English file to the … Sep 5, 2017

if target[id]["message"] == base[id]["message"]:
nottranslated.append(id)
print(join(base_path, target_file_name))
Copy link
Collaborator

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?

# 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
Copy link
Collaborator

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

@LEDfan LEDfan merged commit 6477f4e into master Sep 5, 2017
@LEDfan LEDfan deleted the sync_trans_script branch September 5, 2017 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants