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

Code for using swirly brackets as global language tag. #282

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

raxdev
Copy link

@raxdev raxdev commented Oct 10, 2015

In response to support thread on Wordpress.org - https://wordpress.org/support/topic/is-it-possible-to-use-different-language-separator-than-and?replies=4

Below please find the code for substituting [ for { as language tags.
As for the code structure, I went along the suggestions, also added simple UI for db conversion and a new advanced option to use alternative language tag {.

Added database migration code.
Added an advanced option to switch language tag between [ and { - migration needed after switch.
@johnclause
Copy link
Member

Thank you very much, we need to finish a couple of other things first. Did you test it? Does it indeed help? Please, try using the latest qtx from GitHub when testing. Is there a way for you to list the steps to reproduce an example of an actual problem you are solving with it?

@raxdev
Copy link
Author

raxdev commented Oct 11, 2015

I did test it and it does help a lot! I used latest trunk code from GitHub with my modifications and experienced no issues with qtx working in the swirly bracket mode.
In general, the problem this patch solves is that it allows for qtx to be used alongside Visual Composer-type plugins that don't allow [ ] characters to be entered into text fields.
This is fundamentally not qtx issue, as the problem is related to other plugin' code and lack of their support for "[" or "]" (or shortcodes in attributes), but letting QTranslate-X to use different language tag separator allows to bypass the problem (and probably expand potential QTX reach).

To see that Visual Composer breaks when you use such characters, you don't even need to install QTX - just a VC demo site will sufice. Repro steps:

  1. Create a demo site http://vcpreview.com/
  2. Edit Homepage with Visual Composer
  3. Edit first custom heading - set the text value to [:en]Visual Composer is qtranslate-x-2.8 + qtranslate-slugs is broken #1 Most Popular[:]
  4. Edit second custom heading - set the text value to [ This is Great ]
  5. Update the page - see Text value being reset to empty string after the save for both edited entries.

On my test site I have following QTX integrations plugins active:

  • Yoast SEO & qTranslate-X
  • WPBakery Visual Composer & qTranslate-X
  • qTranslate slug
  • Google XML Sitemaps v3 for qTranslate
    I experienced no difference in the way the site functions after making the switch to swirly mode.

The main benefit for me to be able to use "Editor Raw Mode" and create one layout for a single page, with all text entries containing all language translations that I want.

Also - I did not test this - but the way I adjusted the code, the switch to "{" should be fully reversible, should someone wish to fall back to the default setting.

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

Successfully merging this pull request may close these issues.

None yet

2 participants