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

How to show only available languages for page #303

Closed
dopesong opened this issue Nov 2, 2015 · 6 comments
Closed

How to show only available languages for page #303

dopesong opened this issue Nov 2, 2015 · 6 comments

Comments

@dopesong
Copy link

dopesong commented Nov 2, 2015

I want in language switcher only to show languages into which that page is translated. How I can do that?

@johnclause
Copy link
Member

This seems like a request for new feature, I updated https://qtranslatexteam.wordpress.com/desirable/.
I am not sure when we can get on it, but anyone is welcome to code new features and to submit pull request.

If you decide to do coding, please let us know your plan before going too deeply. The problem with this one is that information about languages available is not easily available at front end. We need then to implement some kind of caching, otherwise it will be too much of performance overhead.

@dopesong
Copy link
Author

dopesong commented Nov 2, 2015

I could do that, but I need some basic information :) How to check if page have specific translation for example.

@johnclause
Copy link
Member

Great. Why don't you make a function qtranxf_getPageAvailableLanguages() and make use of it instead of qtranxf_getSortedLanguages in function qtranxf_generateLanguageSelectCode and instead of foreach($q_config['enabled_languages'] as $lang) in function qtranxf_add_language_menu_item. Make qtranxf_getPageAvailableLanguages() to return list of languages as usual by default.

If option 'Hide Content which is not available for the selected language' is on and if we are on a single post or page (figure out those "if"s), then we will return only available languages. I will put the code to fetch the available languages then in. I have an idea how to do that caching mechanism, and it would be too much to explain in words.

@mastershadow
Copy link

This could be also affine to my request #297 (sorry but I haven't had time to check out the commit @johnclause made).

@dopesong
Copy link
Author

@johnclause we already implemented this by ourselves. Check pull request 👍

@johnclause
Copy link
Member

Hi, I truly apologize, @dopesong, for disappearing, I hurt my back and was immobilized for a while. Very good, that you found a way. I will take a look at your p r, and am closing this issue, we can still write into it or may reopen it if needed. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants