joomla-projects / com_localise

forked version of the original com_localise for experimental purposes
GNU General Public License v2.0
24 stars 36 forks source link

Allow Empty / Blank Strings - Dont re-load origin string if string saved as empty #335

Open dieskim opened 6 years ago

dieskim commented 6 years ago

Steps to reproduce the issue

  1. Open a component language file
  2. save a string as blank / empty
  3. Load the language file again to edit other strings

Expected result

  1. Strings saved as blank/empty remains blank

Actual result

  1. String re-loads from origin file

Additional comments

  1. There are use cases for blank/empty language strings as some languages dont need all language strings and can simple have them empty
infograf768 commented 6 years ago

will test asap.

infograf768 commented 6 years ago

@dieskim

I confirm your findings. Not sure we should consider it as an issue. A simple way to get rid of the problem in your case is to enter a space in the field. In this case, com_localise will consider the field as translated.

dieskim commented 6 years ago

@infograf768 - yes I can use a space, but then the space gets output in the actual output code, and this can at times get pretty ugly, espessially if you have two or 3 language strings next to each other

If for Example:

$chapterTitle = JText::_('COM_CHAPTER_TITLE_PREFIX_SEPERATOR') . JText::_('COM_CHAPTER_TITLE_SEPERATOR') . JText::_('COM_CHAPTER_TITLE_CHAPTERNAME') . $chapterNumber;

In something like that you will now have 3 spaces if we have to use spaces - then the $chapterNumber - but if we use blank(null) we can use any combination, 1 , 2, 3 or non and have no spaces.

A simple fix would be to add a global config that we can enable to ignore and not reload blank values?

infograf768 commented 6 years ago

I then suggest you use ​ the zero width space: https://www.fileformat.info/info/unicode/char/200B/index.htm in the field. It should work for your needs.

I used it below between separator and 12

separator​12