Bilingual HTML block

Hello... I've added an HTML block to my homepage with a "Welcome" message. It's all good except that my site is bilingual... I can of course create a language key to write the welcome message in each language. But how do I make the HTML block use a language key...? What's the best way to do this...? Any ideas or suggestions greatly appreciated!

Quote · 18 Dec 2015

I personally wouldn't do it this way (if even it can be done).


I'd use javascript to:

  1. add the Welcome message in each language available
  2. in that script query the language that the user has set in dolphin
  3. display the output for that language in the HTML block
  4. copy all that javascript code into the HTML block

This shouldn't be too hard to do.

Quote · 19 Dec 2015

Just use the code highlighted in red in your html block. Make sure you toggle off TinyMCE!

 

<bx_text:_welcome_message />   ( _welcome_message is the language key name )


(Whatever name you use for the key name MAKE SURE there is a single space before the forward slash.. otherwise it won't work)

 

Then in admin >settings > language settings > Add Key

 

Key Name:  _welcome_message

Then just add your welcome message for all the different languages and save.  Done.

 

AddLanguageKey.png · 17.2K · 477 views
HTMLblock.png · 23.5K · 483 views
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 19 Dec 2015

Brilliant! Thank you guys! :-)

Quote · 22 Dec 2015

...except... after I add the line <bx_text:_welcome_text_title /> in my html block and save, the line just disappears (_welcome_text_title is my variable). I even tried adding other code to see what effect it had. So if I add to the HTML block the following:

 

<h1>test</h1>
<bx_text:_welcome_text_title />
<h1>test2</h1>


After I save, and check again the code in the HTML block, I find that it has magically changed to:

 

<h1>test</h1>
<h1>test2</h1>

 

The "<bx_text:_welcome_text_title />" is just "automatically removed" somehow...

 

Ideas...? :-\

Quote · 22 Dec 2015

This is happening because several years ago, Boonex did something really stupid. They added TinyMCE to the HTML block.  TinyMCE will strip out all kinds of code even if you toggle it off.  I usually remove it altogether from the HTML block editor

Here's how: https://www.boonex.com/forums/topic/Adsense-stripping-again-.htm#266172

Or you can just replace your  /inc/classes/BxDolPageViewAdmin.php  with the one I've attached (7.2.1 version)

 

This will remove the TinyMCE editor entirely, and your html block editor will look like the one in the screen shot above.  You'll no longer have to worry about code being stripped.

BxDolPageViewAdmin.php · 34.8K · 300 downloads
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 22 Dec 2015

Excellent...! Thank you, HL! :-)

Quote · 23 Dec 2015

OK, the HTML editor works great now... However my bx_text code displays nothing (blank). Not only I've triple-checked that I have the correct language variable name, but I also tried using another language variable which is displaying OK elsewhere in my site (_XF_Home). In my HTML block I have:

 

<h1>test3</h1>
<bx_text:_welcome_text_title />
<bx_text:_XF_Home />
<bx_text:_welcome_text_2 />
<bx_text:_welcome_text_3 />
<h2>test4</h2>


And all I see is the attached...

 

Cry

test.png · 1.9K · 253 views
Quote · 23 Dec 2015

The only way that screen shot is possible, is if everything between your head tags is stripped out. Have you cleared the /cache folder?

 

Even if there were no language keys added, you would see this:

test3

_welcome_text_title _XF_Home _welcome_text_2 _welcome_text_3

test4

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 23 Dec 2015

One other way it is possible, is if your string text field for your language key entry is empty

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 23 Dec 2015

Hello HL, many thanks for your feedback... The strings are not empty, and I had included _XF_Home because that one was showing up OK elsewhere. I cleared the cache ("All") via Admin panel, but even so I see lots of files in the .../public_html/dolph/cache folder (mostly very recent files, but there's a file from November in the .../cache/CSS folder and another from October in the .../cache/URI folder ) There's also the file .htaccess which I believe I should not touch (?)


I found something interesting... Even as I have the space and "/" after the string fields (as seen in the attached HTML_Block.jpg, when I go to Firebug (firebug.jpg) , there is no space or "/" after the string. Would this make sense...?



HTML_Block.jpg · 64K · 492 views
Firebug.jpg · 62.3K · 473 views
Quote · 28 Dec 2015

You should consider getting rid of that extra > after the last h2 tag in this screen shot.

 

 

As far as your other screen shot, it makes no sense at all.  It's like there's an opening and closing tag for each of your custom tag., ie, <bx_text:_welcome_text_title>  and later </bx_text:_welcome_text_title>

How in hell you get all the garbage code shown below from what is shown in the code area above,  I can't even begin to explain.  You didn't do something weird when adding the language strings, did you?

 

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 29 Dec 2015

Here's an idea: Go to admin > Tools > Cache

 

Uncheck Enable cache for HTML files

Clear cache

 

Then see if it behaves normally.  I think there's a fuckedupedness in Boonex's HTML files caching.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 30 Dec 2015

I keep most of the caching off since the beginning of using Dolphin due to issues with caching.  Deano has stated in many posts when people had issues to turn off caching.  My first problem was with the CSS caching in which the CSS for the site would fail to load.  Turning off CSS caching and clearing and the problem never returned.

 

I think Boonex needs to revisit all of the Boonex caching; I am not sure if any of it has been updated.  There certainly have been issues with more than just the HTML caching.

Geeks, making the world a better place
Quote · 30 Dec 2015

Hello,

 

i dont know about ElAmargo but i tried exactly the same and the unchecking of HTML enablement is the solution in my case.........

 

Many thanks !!!!!!

Quote · 2 Jan 2016

YES! I unchecked "Enable cache for HTML files" and it now works as it should...! Thank you all (specially HL) for your patience and insight...! Smile

Quote · 5 Jan 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.