[BlueOnyx:23892] Re: tooltip hover blink bug at php options

Michael Stauber mstauber at blueonyx.it
Sat May 23 13:31:18 -05 2020


Hi Tomohiro Hosaka,

> I think the tooltip text for PHP options is important to users, but
> unfortunately I can't read it.
> https://bokut.in/blueonyx_tiptip_tip_left_blink.gif
> 
> Is it possible to fix it?

Yes and this is actually something where I really would appreciate your
help and expertise to get it fixed.

Here is the problem:

For these mouse-over help texts in all languages *but* Japanese we use
word-wrap.

The function that does this for us is called getWrapped() and it can be
found here in the base-alpine code:

https://devel.blueonyx.it/trac/browser/BlueOnyx/5209R/platform/alpine.mod/ci/application/libraries/I18n.php#L182

You feed it a "tag" (like "php_security"), a "domain" (which module has
the language files (like "base-vsite") an (optionally) an array of
replacement strings to populate certain placeholders in the locale
files. It then *should* return a word wrapped text string that contains
the desired text in the language which the person using the GUI has
configured.

The critical part being this here:

204	    if ($ini_langs['locale'] == "ja_JP") {
205	      // We can't word wrap Japanese without creating some
              // undesired results.
206	      // So we simply don't word wrap it and just replace
              // hard returns:
207	      $transwebbed = str_replace("\n","<br>", $out_txt_clean);
208	      $transwebbed = str_replace('"', "'", $transwebbed);
209	      return $transwebbed;
210	    }
211	    else {
212	      $out_txt_clean = str_replace('"', "'", $out_txt_clean);
213	      $translated = @htmlentities(html_entity_decode(
                 htmlspecialchars_decode($out_txt_clean, ENT_QUOTES),
                 ENT_QUOTES), ENT_QUOTES, $ini_langs['localecharset']);
214	      $transwebbed = 204	    if ($ini_langs['locale'] == "ja_JP") {
205	      // We can't word wrap Japanese without creating some undesired
results.
206	      // Se we simply don't word wrap it and just replace hard returns:
207	      $transwebbed = str_replace("\n","<br>", $out_txt_clean);
208	      $transwebbed = str_replace('"', "'", $transwebbed);
209	      return $transwebbed;
210	    }
211	    else {
212	      $out_txt_clean = str_replace('"', "'", $out_txt_clean);
213	      $translated =
@htmlentities(html_entity_decode(htmlspecialchars_decode($out_txt_clean,
ENT_QUOTES), ENT_QUOTES), ENT_QUOTES, $ini_langs['localecharset']);
214	      $transwebbed = word_wrap($translated, 75);
215	      $transwrapped = str_replace("\n","<br>", $transwebbed);
216	      return $transwrapped;
217	    }($translated, 75);
215	      $transwrapped = str_replace("\n","<br>", $transwebbed);
216	      return $transwrapped;
217	    }

As you can see: Anything but Japanese is word_wrapped() at around 75
characters. That turns a long single line help-text into something that
has multiple lines if needed. That increases readability and makes sure
the text is not wider than the screen either.

The blinking mouse-over text happens when a line is so long that the
help text doesn't fit onto the screen.

However: I have no idea how I can do a sensible word-wrap of Japanese
without hurting the readability or making it an eye sore.

Do you by chance have any recommendation how the above function could be
improved to allow us to do word-wrap for Japanese in a way that's
actually useful?

Thank you!

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list