Skip to content

ENH: compile *.po files when building the package#7079

Merged
peircej merged 4 commits intopsychopy:devfrom
hsogo:dev
Feb 3, 2025
Merged

ENH: compile *.po files when building the package#7079
peircej merged 4 commits intopsychopy:devfrom
hsogo:dev

Conversation

@hsogo
Copy link
Copy Markdown
Contributor

@hsogo hsogo commented Jan 31, 2025

Because recent Standalone Installers for Windows didn't include compiled translation files (messages.mo), label strings in the applications are not translated. I guess that buildWinDistributions.ps1 is intended to compile *.po files when building the Standalone Installer, but it doesn't seem to work.

In this pull request, I tried to compile *.po files when building the package. This is achieved by putting pdm_build.py in the root directory of the project. The content of this script is almost the same as building/compile_po.py. The pdm backend automaticall run this script when building the package (i.e. running python -m build .).

I also tried to add custom-hook = "building/compile_po.py" to [build-system] of pyproject.toml to run building/compile_po.py directly, but in this case building/compile_po.py is included in the built package even though excludes = ["building/"] is in [build-system] of pyproject.toml.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.99%. Comparing base (3acf113) to head (589bea1).
Report is 30 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7079      +/-   ##
==========================================
- Coverage   50.00%   49.99%   -0.01%     
==========================================
  Files         347      347              
  Lines       64057    64062       +5     
==========================================
- Hits        32031    32028       -3     
- Misses      32026    32034       +8     
Components Coverage Δ
app ∅ <ø> (∅)
boilerplate ∅ <ø> (∅)
library ∅ <ø> (∅)
vm-safe library ∅ <ø> (∅)

@peircej peircej merged commit 97ba48c into psychopy:dev Feb 3, 2025
7 checks passed
@peircej
Copy link
Copy Markdown
Member

peircej commented Feb 3, 2025

Apologies for the delayed response to the issue previously @hsogo
Actually, the build process is driven, these days, by a separate private devops repository so that we can connect it with privately hosted Github Runners and domain secrets. The setupApp script(s) need cleaning up which I'll try and do this week.

You were right that I had missed the step of rebuilding the mo files in the devops script though and that has now been added in

For the commit you add here, I don't actually use pdm build to make the standalone apps, but I'll look into whether that will also help the system. Happy to include the file here though on the basis that some 3rd-party developers may use that in their pipeline and will therefore benefit

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