*sum: Fix locales fetching from checksum_common after installation

This commit is contained in:
Dorian Peron
2026-01-30 10:32:27 +01:00
parent 7d633633b0
commit c659947136
3 changed files with 23 additions and 2 deletions
+6 -2
View File
@@ -266,9 +266,13 @@ locales:
fi; \
done
# Some utils require extra locale files outside of their package:
# - *sum binaries need the files from checksum_common
INSTALLEES_WITH_EXTRA_LOCALE = \
$(INSTALLEES) \
$(if $(findstring sum, $(INSTALLEES)),checksum_common, )
install-locales:
@for prog in $(INSTALLEES); do \
@for prog in $(INSTALLEES_WITH_EXTRA_LOCALE); do \
if [ -d "$(BASEDIR)/src/uu/$$prog/locales" ]; then \
mkdir -p "$(DESTDIR)$(DATAROOTDIR)/locales/$$prog"; \
for locale_file in "$(BASEDIR)"/src/uu/$$prog/locales/*.ftl; do \
+9
View File
@@ -144,6 +144,15 @@ fn embed_single_utility_locale(
.join(format!("locales/{locale}.ftl"))
})?;
if util_name.ends_with("sum") {
embed_component_locales(
embedded_file,
locales_to_embed,
"checksum_common",
|locale| project_root.join(format!("src/uu/checksum_common/locales/{locale}.ftl")),
)?;
}
// Always embed uucore locale file if it exists
embed_component_locales(embedded_file, locales_to_embed, "uucore", |locale| {
project_root.join(format!("src/uucore/locales/{locale}.ftl"))
+8
View File
@@ -261,6 +261,14 @@ fn create_english_bundle_from_embedded(
bundle.add_resource_overriding(uucore_resource);
}
// Checksum algorithms need locale messages from checksum_common
if util_name.ends_with("sum") {
if let Some(uucore_content) = get_embedded_locale("checksum_common/en-US.ftl") {
let uucore_resource = parse_fluent_resource(uucore_content)?;
bundle.add_resource_overriding(uucore_resource);
}
}
// Then, try to load utility-specific strings
let locale_key = format!("{util_name}/en-US.ftl");
if let Some(ftl_content) = get_embedded_locale(&locale_key) {