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

Improve placeholders match and visibility #1619

Open
7 of 8 tasks
pedro-mendonca opened this issue May 4, 2023 · 1 comment
Open
7 of 8 tasks

Improve placeholders match and visibility #1619

pedro-mendonca opened this issue May 4, 2023 · 1 comment
Labels
[Type] Enhancement A suggestion for improvement.

Comments

@pedro-mendonca
Copy link
Member

Currently the placeholders have no particular visual adds.
While trying to add some simple CSS the placeholders, found that some aren't even matched.


Matched placeholders

There are a few currently matched placeholder patterns, all start with % and end with it's type (s, d, l, etc.).
There are a few optional parameters: can be with or without index (eg.: %s or %1$s), and with or without minimum width (eg.: %1$s or %1$1s, less used, but also supported).

No indexed placeholders:

  • %s (s: string)
  • %d (d: integer)
  • %l (l: list)
  • %1s, %2s, %3s, %10s, %20s, %30s, etc (The integer is the minimum width of the placeholder. The type can be s, d, l, etc.) *

Indexed placeholders:

  • %1$s (s: string)
  • %d (d: integer)
  • %l (l: list)
  • %1$1s, %1$2s, %1$3s, %1$10s, %1$20s, %1$30s, etc (The 1$ is index. The integer after the index is the minimum width of the placeholder. The type can be s, d, l, etc.)

* The pattern of no indexed placeholders with minimum width set isn't currently matched. Needs a fix.


Visibility

Would be great to add some visual notation to easily spot placeholders.

Currently the placeholders are shown without any visual adds.

imagem

Suggestion of some visual adds to easily spot placeholders, with specific class and simple CSS.

imagem

@ocean90 ocean90 added the [Type] Enhancement A suggestion for improvement. label Jun 8, 2023
@NekoJonez
Copy link
Contributor

This is GlotDict's solution:
image

Like the second screenshot from Pedro, it highlights the placeholders quite well. But what's handy, it also shows a list underneath the editor which placeholders were already added and which ones not. You can also click on them, to insert them at your current location in the editor which is also helpful.

Now, why not also implement this for HTML tags or things that are between [] ?
Also, if we are going to implement this on translate.wp.org ... we need to look at Openverse that's using ###placeholder###

I can totally agree with the fact if we look at all of these other types of placeholders that the scope of this enhancement is going through the roof... Besides, one type of placeholders can be very handy too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants