Skip to content
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

Unable to add custom languages without causing "Undefined index" error. #171

Closed
herrvigg opened this issue Jun 22, 2018 · 3 comments
Closed
Labels
bug Something isn't working, reproducible legacy issue Legacy issue imported from original repo

Comments

@herrvigg
Copy link
Collaborator

Issue by taai
Friday May 29, 2015 at 12:59 GMT
Originally opened as qTranslate-Team/qtranslate-x#171


I have added an Austrian language and chosen "at" language code. I know that in Austria they speak German, but still - I need to use "at" as a language code...

"qTranslate X" throws this error:

Notice: Undefined index: at in /public/wp-content/plugins/qtranslate-x/qtranslate_hooks.php on line 36

Appearently there is no arra key "at" in the array returned by qtranxf_default_windows_locale() function, so this line throws that error:

$locale[] = $windows_locale[$lang];

So, how to add custom (unlisted in this plugin) languages? Would you add some filter in qtranxf_default_windows_locale() function or figure out some better way?

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Tuesday Jun 02, 2015 at 01:24 GMT


Thank you for the report. I changed this line to

if(isset($windows_locale[$lang])) $locale[] = $windows_locale[$lang];

If "Locale" for language itself is set meaningfully, then it should work ok even with this waring.

Does it work for you regardless this message?

@herrvigg herrvigg added bug Something isn't working, reproducible legacy issue Legacy issue imported from original repo labels Jun 22, 2018
@herrvigg
Copy link
Collaborator Author

Comment by taai
Tuesday Jun 02, 2015 at 13:43 GMT


@johnclause I think it should work without checking that the key exists. But it had to be fixed. Thank you! 👍

@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Tuesday Jun 02, 2015 at 17:20 GMT


This is the only place where 'windows_locale' is in use, and if Windows does not have this code there is no neither need nor way to make it up meaningfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working, reproducible legacy issue Legacy issue imported from original repo
Projects
None yet
Development

No branches or pull requests

1 participant