Skip to content

Commit fa2e9dd

Browse files
authored
[Meta/Multilingual] Add wildcard target for .mo files (#10036)
This adds a new wildcard target to convert .po files to .mo files. Each `make modulename` target is updated to have a dependency on the .mo files that it uses, rather than explicitly running msgfmt multiple times. This means that when running `make modulename` it will only run the msgfmt command if the po file has changed. `make locales` should also be updated to make building loris more efficient when doing development, but that it not done in this PR to avoid conflicts with other module PRs that are in progress. It will be done in a future PR. This is a simplified version of #10003 that puts the infrastructure in place but should be less likely to cause conflicts.
1 parent 21a1d0d commit fa2e9dd

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

Makefile

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
all: node_modules locales VERSION vendor
44
npm run build
55

6+
%.mo: %.po
7+
msgfmt -o $@ $<
8+
69
# If anything changes, re-generate the VERSION file
710
VERSION: .
811
tools/gen-version.sh
@@ -133,55 +136,51 @@ locales:
133136
msgfmt -o modules/user_accounts/locale/ja/LC_MESSAGES/user_accounts.mo modules/user_accounts/locale/ja/LC_MESSAGES/user_accounts.po
134137

135138

136-
acknowledgements:
139+
acknowledgements: modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.mo
137140
target=acknowledgements npm run compile
138141

139142
create_timepoint:
140143
target=data_release npm run compile
141144

142-
data_release:
143-
msgfmt -o modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules/data_release/locale/hi/LC_MESSAGES/data_release.po
145+
data_release: modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.mo
144146
npx i18next-conv -l hi -s modules/data_release/locale/hi/LC_MESSAGES/data_release.po -t modules/data_release/locale/hi/LC_MESSAGES/data_release.json
145-
msgfmt -o modules/data_release/locale/ja/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.po
146147
npx i18next-conv -l ja -s modules/data_release/locale/ja/LC_MESSAGES/data_release.po -t modules/data_release/locale/ja/LC_MESSAGES/data_release.json
147148
target=data_release npm run compile
148149

149-
instrument_manager:
150+
instrument_manager: modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.mo
150151
target=instrument_manager npm run compile
151152

152-
dataquery:
153+
dataquery: modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo
153154
msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po
154155
target=dataquery npm run compile
155156

156-
login:
157+
login: modules/login/locale/ja/LC_MESSAGES/login.mo
157158
target=login npm run compile
158159

159-
module_manager:
160+
module_manager: modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo
160161
target=module_manager npm run compile
161162

162-
mri_violations:
163+
mri_violations: modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo
163164
target=mri_violations npm run compile
164165

165-
issue_tracker:
166+
issue_tracker: modules/issue_tracker/locale/ja/LC_MESSAGES/issue_tracker.mo
166167
target=issue_tracker npm run compile
167168

168-
candidate_list:
169-
msgfmt -o modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.po
169+
candidate_list: modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.mo
170170
npx i18next-conv -l ja -s modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.po -t modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.json
171-
msgfmt -o modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.po
172171
npx i18next-conv -l hi -s modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.po -t modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.json
173172
target=candidate_list npm run compile
174173

175-
candidate_parameters:
174+
candidate_parameters: modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.mo
176175
target=candidate_parameters npm run compile
177176

178-
dashboard:
177+
dashboard: modules/dashboard/locale/ja/LC_MESSAGES/dashboard.mo
179178
target=dashboard npm run compile
180179

181-
publication:
180+
publication: modules/publication/locale/ja/LC_MESSAGES/publication.mo
182181
target=publication npm run compile
183182

184-
server_processes_manager:
183+
server_processes_manager: modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.mo
185184
target=server_processes_manager npm run compile
186185

187186
conflict_resolver:

0 commit comments

Comments
 (0)