Skip to content

Some fixes and enhancements for the make file #678

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

Merged
merged 2 commits into from
Apr 11, 2025
Merged

Conversation

prculley
Copy link
Contributor

Been looking at the translation automation in make.
Big one, it looks like the extracted po files don't contain .pot msgid strings that should be satisfied from the Gramps main translations. You stripped those out of the overall pot, to reduce translation work, good.
But when you did the extraction of main po files to individual addons, the Gramps strings were not included.

A smaller issue, Windows system (mine at least) doesn't include a "touch" command.
Also on Windows, you have to specify utf8 when opening a file or you get errors due to default code page.

I also added the ability to do a single file "as-needed", but may still want to enhance further with updated po etc. when the Weblate changes settle down.

I suspect that some of the other commands will fail for the 'all' when they hit the new po directory, but have not yet tested and fixed these.

make.py Outdated
print(f"No language file for {lang} in po/ ?")
continue
system(
f'msgcat --use-first po/{lang}.po {GRAMPSPATH}/po/{lang}.po -o "po/{lang}_g.po"'
Copy link
Member

@Nick-Hall Nick-Hall Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to do this?

The get_addon_translator method returns a translator that looks in both the gramps and addon domains for translations. It uses the add_fallback method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a script that reports the percentage of strings done for each addon/lang. It was consistently showing less than 100%, which led me to investigate what was missing. The Gramps strings. I studied the make "update" code and realized that the new process was not including the Gramps strings, where the old process was.

I confess that I did not test to see if the addon was actually using the Gramps strings when an individual string was missing. So I assumed that we needed to emulate the old process. I'll run some more tests to make sure I understand all this, and then rework this PR. When I have some more time (life still happens!).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few unit tests in PR #2023 just to check that the translator was working as expected.

It actually looks in gramps.mo first and then uses addon.mo as the fallback. Any strings from Gramps core that end up in an addon.mo file will be ignored.

@Nick-Hall
Copy link
Member

But when you did the extraction of main po files to individual addons, the Gramps strings were not included.

This is intentional. The addon translators should look in both the gramps and addon domains.

@Nick-Hall
Copy link
Member

A smaller issue, Windows system (mine at least) doesn't include a "touch" command.

I thought that might be the case, but I saw that it was used elsewhere. My original implementation of strip_header used a "sed" command, but I anticipated a problem there. :)

@GaryGriffin
Copy link
Member

Are all of the questions resolved such that this is ready to merge? The list of changes seem to mostly be about replacing 'touch' and some lint changes. The specific question from Nick seems to be resolved.

@Nick-Hall
Copy link
Member

Rebased.

@Nick-Hall
Copy link
Member

Are all of the questions resolved such that this is ready to merge?

Yes. I'll merge this now.

@Nick-Hall Nick-Hall merged commit ac64f06 into maintenance/gramps60 Apr 11, 2025
@Nick-Hall Nick-Hall deleted the fun branch April 11, 2025 13:21
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.

3 participants