steveooo Posted March 9, 2016 Share Posted March 9, 2016 Hello guys, When developing a module, you can make the module support multi-language by using __() etc. Is there a way / standard to add some language .json files to the module folder for ProcessWire to import automatically? Or do I always have to import these language files manually? Great would be: My finished module auto-imports a translations.json file in the module's directory on initial install. Maybe some standards like https://en.wikipedia.org/wiki/ISO_639-1 so ProcessWire can iterate through the translations.json and checks if each language is installed. If so, then PW automatically imports the needed json language data for this specific language. Thanks for your answers! Steve Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 9, 2016 Share Posted March 9, 2016 You're mentioning exactly the point, which does prevent that. It would need some kind of standard about language naming and that one is simply not existing in processwire (and even might not in the future). Languages (besides default) can be named however the admin does feel like. You could always implement a custom function into the install() method to check for languages named correctly and if so install any files. Other people would need to install them manually. Also a point about the default language. This one can be any language, but it's always named default. That's a problem as well. 1 Link to comment Share on other sites More sharing options...
BitPoet Posted March 9, 2016 Share Posted March 9, 2016 There's a point though. Perhaps a ISO language code dropdown could be added to the language template together with a checkbox to allow automatic installation of language packs by new modules according to the selected value. This would keep backwards compatiblity yet allow for automatic installation (through module install). Adding a mechanism to query installed modules whether they provide translation packages for newly added languages could be accomplished by hooking Languages::added. The only problem I see are languages that differ quite a bit in ISO 639-1 groups, which, for example, captures all variants of Chinese under the lable zh. Yet ISO 639-3 may be too fine-grained. A two-part solution like Unix and Windows use would IMHO be better (e.g. zh-cn, de-de, with fallback to the first two letters). 1 Link to comment Share on other sites More sharing options...
bernhard Posted April 3, 2021 Share Posted April 3, 2021 I've created an issue in the requests repo - please give it a thumb up to show demand for such a feature! https://github.com/processwire/processwire-requests/issues/396 Link to comment Share on other sites More sharing options...
bernhard Posted November 3, 2021 Share Posted November 3, 2021 This feature was added lately ? Docs can be found here: https://processwire.com/blog/posts/pw-3.0.181-hello/ 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now