-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translation support #218
Comments
A nice way to make this library translatable is this https://github.com/WebDevStudios/CPT_Core/blob/master/CPT_Core.php#L253-L265 |
I think the reference has changed since you linked to it. I think there's a wider issue here though. Currently, if TGMPA is included in a theme, then that theme can generate a .pot with the TGMPA strings, but they may not be applied since TGMPA has a PHP variable for a textdomain. If they exclude it, then they don't appear in any .pot file. I think we need to be providing the .pot, .po and .mo (GlotPress install somewhere found via translate.tgmpluginactivation.com) for TGMPA ourselves, and then have the textdomains as |
A lasting reference is: https://github.com/WebDevStudios/CPT_Core/blob/df1b621bcb03c6a96a13204940600a11b6a62b82/CPT_Core.php#L309-L322 The textdomain is not a var (anymore), right? |
@GaryJones I believe having TGMPA native language files is not the right way to go. Some text string now literally say 'theme' while the library may also be included in plugins, so leaving the providing of the language strings up to the implementing theme/plugin makes a lot of sense. |
If a theme and several plugins in an install all use TGMPA, then that's lots of the same strings that need translating. If we did it ourselves, providing the localisations as well, then that's a whole bunch of strings that can be excluded from the theme and plugin .pot files. We translate it once, correctly, and load the textdomains from the right location, and those that include that include TGMPA moving forward can include the languages folder too. |
https://ulrich.pogson.ch/future-pot-generators from @grappler also suggests TGMPA having it's own language file(s). |
I do think that libraries should manage their own translations but it is not always so easy. The time is would work great is if a theme or plugin was using composer to define the dependency and loading all of the files. The themes on WordPress.org are only allowed to define two text domains. The first for the theme and the second for a framework. If a theme is using a settings framework and a TGM then they would already have three text domains. Another factor that needs to be taken into account that one day WordPress.org will offer GlotPress projects for every plugin and theme. As Makepot.php does not look at the text domain all of the strings will be added to the project anyway. My recommendation would be to would be to define all of the strings in |
Closing as loading of native translations has been added in dev via #521. For those publishing themes via wp.org, if you download using the new Custom TGMPA Generator, will change the text domain to the theme's and will defer to the theme's loading of the text domain (and remove the TGMPA load call). |
It is nice that functions like
__()
and_e()
are being used but using a translation for the library is "complex".Since I am will need it soon I will have a look at how to do it best. Will post sample code and potentially PRs here.
The text was updated successfully, but these errors were encountered: