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
taai opened this issue May 29, 2015 · 3 comments
Closed
Labels

Comments

@taai
Copy link

taai commented May 29, 2015

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?

johnclause added a commit that referenced this issue Jun 2, 2015
@johnclause
Copy link
Member

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?

@johnclause johnclause added the bug label Jun 2, 2015
@taai
Copy link
Author

taai commented Jun 2, 2015

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

@taai taai closed this as completed Jun 2, 2015
@johnclause
Copy link
Member

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
Projects
None yet
Development

No branches or pull requests

2 participants