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
herrvigg opened this issue Jun 22, 2018 · 2 comments
Open

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

herrvigg opened this issue Jun 22, 2018 · 2 comments
Labels
legacy PR Legacy PR imported from original repo

Comments

@herrvigg
Copy link
Collaborator

Issue by raxdev
Saturday Oct 10, 2015 at 00:12 GMT
Originally opened as qTranslate-Team/qtranslate-x#282


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 {.


raxdev included the following code: https://github.com/qTranslate-Team/qtranslate-x/pull/282/commits

@herrvigg herrvigg added the legacy PR Legacy PR imported from original repo label Jun 22, 2018
@herrvigg
Copy link
Collaborator Author

Comment by johnclause
Sunday Oct 11, 2015 at 06:00 GMT


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?

@herrvigg
Copy link
Collaborator Author

Comment by raxdev
Sunday Oct 11, 2015 at 10:57 GMT


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
legacy PR Legacy PR imported from original repo
Projects
None yet
Development

No branches or pull requests

1 participant