-
Notifications
You must be signed in to change notification settings - Fork 202
Implement a way for modules to supply translations #52
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
Implement a way for modules to supply translations #52
Conversation
I'm still not 100% knowledgeable about languages in PW, but does everyone use the same language keys? Like what happens if someone just uses |
|
||
if($translated) { | ||
// exclude modules without translations present | ||
if(!$info['languages'] || !is_array($info['languages']) || !count($info['languages'])) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!count($info['languages'])
is unnecessary since an empty array won't pass !$info['languages']
. PHP converts (type juggles) an empty array to boolean FALSE
and an array with items to boolean TRUE
.
On the other hand you should first check if isset($info['languages'])
or you might run into an E_NOTICE
(undefined variable) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, had that though yesterday evening as well. Might just use empty(), which covers the isset() as well as the count() issue.
@mikerockett It's not automatically importing those translations. You can choose which translation file to import into which installed language. I just named my .csv's in the format of locales, so it's clear which kind of translation you can expect to import. |
738cbee
to
95ccf85
Compare
95ccf85
to
1e5c7a7
Compare
…slations, plus some related updates Co-authored-by: LostKobrakai <benni@kobrakai.de>
Thanks @LostKobrakai I have added this, with a few changes and additions. Biggest differences are that I went without the 'languages' property added to the moduleInfo since I thought the files in the /languages/ directory were already enough. I also left out the "Translated" navigation option in the modules nav, as I guess I thought there wasn't enough need for it, but will add it back if I'm wrong about that. Thanks for the nice addition. |
Module authors can ship translations of their modules by adding a label => relative path combo to their module info block. Paths must be relative to the modules root directory. The files should be exported csv files of just the module translations.
Example info block: