Skip to content

i18n: Use translations for theme name, content, terms, and page title#97

Merged
ryelle merged 12 commits intotrunkfrom
update/use-theme-obj-for-i18n
May 31, 2024
Merged

i18n: Use translations for theme name, content, terms, and page title#97
ryelle merged 12 commits intotrunkfrom
update/use-theme-obj-for-i18n

Conversation

@ryelle
Copy link
Collaborator

@ryelle ryelle commented May 29, 2024

Fixes #74. This uses the theme object content for themes, which should automatically use the localized theme name and description.

Additionally, I've added the in-progress i18n composite action (WordPress/wporg-repo-tools#31), which pulls down term and page titles so that they can be easily imported into GlotPress with the rest of the strings (this is the generated commit 4e78304). As this theme is not being parsed yet, this doesn't do anything, but once it's indexed it should expose those items for translation so that, for example, "Commercially Supported GPL Themes" in the local nav can be translated.

The translation code was pulled from pattern-translations.

Screenshots

The theme title & description are translated. The "Features" list will be translated once the project is in GlotPress (and translated).

Before After
Screen Shot 2024-05-29 at 16 53 48 Screen Shot 2024-05-29 at 16 53 35

How to test the changes in this Pull Request:

  1. Using a sandbox, view a popular theme (more likely it will have translations)
  2. The title and content should appear translated

You can also test the page name and term name translations with Pig Latin, just disable the en_US check in translate_term. You'll see some errors about the font_subset though.

@ryelle ryelle requested review from StevenDufresne and dd32 May 29, 2024 21:08
@ryelle ryelle self-assigned this May 29, 2024
@ryelle ryelle added the i18n Translations, RTL issues label May 29, 2024
Copy link
Member

@dd32 dd32 left a comment

Choose a reason for hiding this comment

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

This looks fine to me.

@dd32
Copy link
Member

dd32 commented May 30, 2024

@ryelle
Copy link
Collaborator Author

ryelle commented May 30, 2024

Yeah, I saw the hardcoded filter list (it's also been copied into the theme, since wporg_themes_query_api( 'feature_list' ) would only return slugs). It sounds like I should remove the textdomain there, if it's meant to inherit from core.

I suppose for tags I could pull from that list of translations instead of generating a duplicate list in translation-strings.php.

@ryelle
Copy link
Collaborator Author

ryelle commented May 30, 2024

oops, this also applies to the pagination links:

Screenshot 2024-05-30 at 11 10 59 AM

@ryelle ryelle force-pushed the update/use-theme-obj-for-i18n branch from 4e78304 to 1d9884c Compare May 30, 2024 15:20
@ryelle ryelle force-pushed the update/use-theme-obj-for-i18n branch from 01b25bd to e637c62 Compare May 30, 2024 15:35
@ryelle
Copy link
Collaborator Author

ryelle commented May 30, 2024

Okay, I've fixed the pagination bug and updated the tag translation to use the features list (and omitted tags from the string export). However, I realized this doesn't match core 100% because I've switched the strings to use sentence-case. So the list is back to using wporg-themes textdomain. It seems like it would be fine to use a slightly different list, since the slugs are the same.

@ryelle ryelle force-pushed the update/use-theme-obj-for-i18n branch from fcbd0ba to 869d8a8 Compare May 30, 2024 15:39
@ryelle ryelle merged commit 6f34924 into trunk May 31, 2024
@ryelle ryelle deleted the update/use-theme-obj-for-i18n branch May 31, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n Translations, RTL issues

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Theme & page content should be translated

2 participants