Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Internationalization hook not added into after_setup_theme #28

Closed
AbmSourav opened this issue Oct 6, 2021 · 5 comments
Closed

Internationalization hook not added into after_setup_theme #28

AbmSourav opened this issue Oct 6, 2021 · 5 comments

Comments

@AbmSourav
Copy link
Contributor

WordPress internationalization hook load_theme_textdomain is not initialized into after_setup_theme hook.
Please let me know, I'll love to send a pull request :)

@jffng
Copy link
Collaborator

jffng commented Oct 6, 2021

👋 Depending on how #30 is handled, I am wondering whether we will need to use this function.

@kjellr
Copy link
Collaborator

kjellr commented Oct 6, 2021

I think we probably do need it — if we do bundle any patterns with the theme, we'd need to use a textdomain. (Though that in turn depends on #12).

@Otto42
Copy link
Member

Otto42 commented Oct 7, 2021

Calls to load the textdomain manually are not required and actually have not been since about WordPress 4.6 or so.

Short version: If you have the proper "Text Domain" and "Domain Path" headers in the style.css file, then WordPress will automatically load the text domain on a just-in-time basis, when they are needed.

The Text Domain should always be identical to the theme's slug, in this case, "twentytwentytwo".

The Domain Path should be the directory inside the theme's directory where any local language files may be located. The default is "/languages".

So, the given pull request that adds this line of code:

load_theme_textdomain( 'twentytwentytwo', get_template_directory() . '/languages' );

In fact that code does absolutely nothing. It's functionally the same as just having the Text Domain: header, which the theme already has.

@kjellr
Copy link
Collaborator

kjellr commented Oct 7, 2021

Thanks for the background, @Otto42 — that's really helpful. I think we can close in that case.

@kjellr kjellr closed this as completed Oct 7, 2021
@Otto42
Copy link
Member

Otto42 commented Oct 7, 2021

Just adding this to note that this only applies to themes and plugins hosted on wordpress.org. Those get translated by the translation pack system. Third party code hosted elsewhere should include their own translations, as per usual.

jeffpaul added a commit to jeffpaul/twentytwentytwo that referenced this issue Nov 16, 2021
Note that some of the references below are not the only contributions (commits, PR review, helpful issue input, etc.) from these folks, but merely the first ones I encountered while reviewing items committed to `trunk` since the initial branch commit.

@westonruter via  WordPress#51
@ntwb via WordPress#73
@juricav via WordPress#113
@Sandstromer via WordPress#69
@jasmussen via WordPress#74
@melchoyce via WordPress#16
@Riyadh1734 via WordPress#182
@desrosj via WordPress#223
@beafialho via WordPress#172
@clucasrowlands via WordPress#171
@Otto42 via WordPress#28
@luminuu via WordPress#107
@felixarntz via WordPress#240
kjellr added a commit that referenced this issue Nov 17, 2021
* add missing props to CONTRIBUTORS.md

Note that some of the references below are not the only contributions (commits, PR review, helpful issue input, etc.) from these folks, but merely the first ones I encountered while reviewing items committed to `trunk` since the initial branch commit.

@westonruter via  #51
@ntwb via #73
@juricav via #113
@Sandstromer via #69
@jasmussen via #74
@melchoyce via #16
@Riyadh1734 via #182
@desrosj via #223
@beafialho via #172
@clucasrowlands via #171
@Otto42 via #28
@luminuu via #107
@felixarntz via #240

* add dotorg handles to CONTRIBUTORS.md

* Fix Rich's WP.org username.

Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants