qTranslate-Team / qtranslate-x

Wordpress plugin: Adds user-friendly and database-friendly multilingual content management and translation support.

Home Page:http://qtranslatexteam.wordpress.com/about/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In qtranxf_generateLanguageSelectCode add another option to $type argument

HowToSolutions opened this issue · comments

I'm using direct call to qtranxf_generateLanguageSelectCode($type,$id) in my template but since my flags are rendered using CSS, I really don't need anything rendered. Unfortunately, there are only
'image', 'text', 'both' and 'dropdown' available for $type argument.

At the moment I solved this by using 'image' option and then hiding those images with CSS, but it would really be great, if there would be some sort of 'none' option.

If you do not call qtranxf_generateLanguageSelectCode at all, wouldn't it be the same as 'none' option?

I guess, better name might be 'css_only' instead of 'none', no image no text, but list of items with css classes? Anyway, would you mind to submit a pull request with the case you wish?

BTW, I never researched, but was always curious, why the original author used java script to generate 'select' item for 'dropdown' option? Do you see why?

BTW, set of arguments for this function never made sense to me ... it probably needs to be re-designed.

I apologize, I should have been more precise.

I call qtranxf_generateLanguageSelectCode, so that the HTML code for Language selection is rendered, I just don't need anything inside it, since I use CSS to render appropriate flags.

I submited the pull request #260 .

Thank you, that was quick. Will be released in 3.4.5.

I updated the widget code with 'css_only' option too, the latest https://github.com/qTranslate-Team/qtranslate-x has it all. I would appreciate if you could test it all.

I tested it and it seems fine. For all the types except 'css_only' I compared the generated HTML code of the latest version with the version currently on WordPress and the generated HTML code is the same.

Looking at the generated code, I did notice something about the 'dropdown' type. It uses onchange event, so it needs JavaScript to function. In cases, when JavaScript is disabled, the 'dropdown' option will simply not be created as it uses JavaScript for rendering and then it falls back to text type.

Thanks!

Please, follow #208, as option 'css_only' has been removed, but you can achieve, what you need with option 'custom' and empty 'format'. Please, continue discussion at #208, if needed.