LycheeOrg / Lychee-front

JS implementation of Lychee frontend

Home Page:https://lycheeorg.github.io/

Repository from Github https://github.comLycheeOrg/Lychee-frontRepository from Github https://github.comLycheeOrg/Lychee-front

Wrong support of ' (single quote) in some places (French localisation)

LudovicRousseau opened this issue · comments

Detailed description of the problem

With the French version some texts are truncated.
For example instead of "Nom d'utilisateur actuel :" I see this:
Capture-d-ecran-2021-09-24-a-22 34 13

The text comes from https://github.com/LycheeOrg/Lychee/blob/master/app/Locale/French.php#L325:

			'USERNAME_CURRENT' => 'Nom d\'utilisateur actuel :',

Steps to reproduce the issue

  • switch the interface in French
  • go to Parameters (so Paramètres in French)
  • erase the first field if you login is present and see the hint message

The problem

I discussed the issue on https://gitter.im/LycheeOrg/Lobby with @nagmat84

It looks like the problematic code is https://github.com/LycheeOrg/Lychee-front/blob/master/scripts/main/view.js#L927

  <p>
	  ` +
	lychee.locale["PASSWORD_TITLE"] +
	`
	  <input name='oldUsername' class='text' type='text' placeholder='` +
	lychee.locale["USERNAME_CURRENT"] +
	`' value=''>
	  <input name='oldPassword' class='text' type='password' placeholder='` +
	lychee.locale["PASSWORD_CURRENT"] +
	`' value=''>
  </p>

Working cases

In other places the single quotes are correctly displayed.
For example with the login screen that uses:

'USERNAME' => 'Nom d\'utilisateur',

I get the correct:
68747470733a2f2f66696c65732e6769747465722e696d2f3562383633346266643733343038636534666136326166622f6b6873392f7468756d622f436170747572652d642d656372616e2d323032312d30392d32352d612d31372e31392e30382e706e67

The corresponding code is https://github.com/LycheeOrg/Lychee-front/blob/master/scripts/main/lychee.js#L352

<p class='signIn'>
	<input class='text' name='username' autocomplete='on' type='text' placeholder='$${
		lychee.locale["USERNAME"]
	}' autocapitalize='off' data-tabindex='${tabindex.get_next_tab_index()}'>
	<input class='text' name='password' autocomplete='current-password' type='password' placeholder='$${
		lychee.locale["PASSWORD"]
	}' data-tabindex='${tabindex.get_next_tab_index()}'>
</p>

Possible solution

In the case the quote are correctly displayed the PHP code uses $${lychee.locale["USERNAME"]} instead of just lychee.locale["USERNAME_CURRENT"].

It looks like the use of $${ } is important here.