Skip to content

Refactor i18n API#5850

Merged
oitel merged 1 commit intomasterfrom
feature/i18n_enhancements
Mar 26, 2026
Merged

Refactor i18n API#5850
oitel merged 1 commit intomasterfrom
feature/i18n_enhancements

Conversation

@oitel
Copy link
Contributor

@oitel oitel commented Mar 26, 2026

  • Add Locale::Domain struct to avoid ambiguous overloads
  • Accept std::string_view to simplify passing std::strings
  • Add Locale::translateAll functions for translating string vectors
  • Add s_tr macro to return std::string directly
  • Translate tab names from .ui.json files
  • Allow to store .pot and .po files in separate locations
  • Fix typo in compile_translations.py

@oitel oitel requested a review from Grantim March 26, 2026 08:53
@oitel oitel force-pushed the feature/i18n_enhancements branch from 8c4073b to c4df5e5 Compare March 26, 2026 08:54
Comment on lines +52 to +55
if(${FOUND_LOCALES_COUNT} EQUAL 1)
message(STATUS "Found ${FOUND_LOCALES_COUNT} translation for ${DOMAIN_NAME}.")
else()
message(STATUS "Found ${FOUND_LOCALES_COUNT} translations for ${DOMAIN_NAME}.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(${FOUND_LOCALES_COUNT} EQUAL 1)
message(STATUS "Found ${FOUND_LOCALES_COUNT} translation for ${DOMAIN_NAME}.")
else()
message(STATUS "Found ${FOUND_LOCALES_COUNT} translations for ${DOMAIN_NAME}.")
message(STATUS "Found ${FOUND_LOCALES_COUNT} translation(s) for ${DOMAIN_NAME}.")

}
readUIJson_( *itemsStructRes );
const auto filename = utf8string( path.filename() );
const auto stem = filename.substr( 0, filename.find( '.' ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

please add comment about .ext.ext situation (to explain why we don't use std stem)

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const auto stem = filename.substr( 0, filename.find( '.' ) );
const auto stem = filename.substr( 0, filename.find( '.' ) ); // cannot use `path.stem()` because of two segment extensions (.ui.json, .items.json)

@oitel oitel force-pushed the feature/i18n_enhancements branch from c4df5e5 to 053dba4 Compare March 26, 2026 09:11
- Add Locale::Domain struct to avoid ambiguous overloads
- Accept std::string_view to simplify passing std::strings
- Add Locale::translateAll functions for translating string vectors
- Add s_tr macro to return std::string directly
- Translate tab names from .ui.json files
- Allow to store .pot and .po files in separate locations
- Fix typo in compile_translations.py
@oitel oitel force-pushed the feature/i18n_enhancements branch from 053dba4 to cfd316b Compare March 26, 2026 09:12
@oitel oitel merged commit 6a63a51 into master Mar 26, 2026
1 check passed
@oitel oitel deleted the feature/i18n_enhancements branch March 26, 2026 09:12
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