Closed JoeSchubert closed 5 years ago
Doesn't seem to be working for me. It's requiring the file ../locale/locale-.php
which means the getLanguage()
function isn't working. I'll try to have a look and try to fix it later.
Ah. Weird, maybe I messed up something prior to committing. Been pretty busy. I'll look at it in just a little bit.
@roenw maybe this will help? Not really sure how to get it to work right... PHP isn't really something I'm great with. But I'm testing it using this test file, with some index-xx.php files in a locales folder with the test file. I've changed the function a little so that you have to pass the configured language and the preferred language. I'm sure that it's something with variable scopes or something.
https://gist.github.com/yoinx/c1d6110ee2805111a7dd726d5ceb2842
@yoinx I'll try to test this tomorrow
@roenw any luck with this?
At some point I’ll try and make it work, but I don’t think it’ll be in this release.
Sent from my iPhone
On Jun 15, 2019, at 3:02 AM, Joe Schubert notifications@github.com wrote:
@roenw any luck with this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I’ll find a better way to do this later. Tabled for a future update.
I like the idea here, translations should definitely be a thing.
This should scan all of the locale-xx.php files in the locales folder, add them to an array and select the desired language based on what the end-user has set up in their browser. If there's no matching translation, default to the one that was specified in the configuration.
The format will have to be ISO-639-1 for the 2 letter codes, see here: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
This default locale file WILL have to exist and there are currently no checks to ensure that. We could protect against that, but at what point are we just protecting people from themselves.