ManeraKai / simplytranslate_mobile

Privacy friendly frontend to Google Translate
https://manerakai.github.io/simplytranslate_mobile/
GNU General Public License v3.0
173 stars 15 forks source link

Information for character counter #112

Closed Valdnet closed 3 years ago

Valdnet commented 3 years ago

Proposal for the new version of the application to add information for the character counter. After clicking on the character counter, information about the number of characters would appear, for example: "Entered 15 characters out of 5000 possible". If it exceeds the value of 5000 characters when the counter is red, then after tapping it may change to e.g. "Exceeded limit 5 characters out of 5000 possible".

Information like this: "The translation input is above 5000".

Such additional information would immediately explain what this meter is about. Currently, the user can click on the character counter, but nothing happens. Only later realizes that this is just information, not a function button.

ManeraKai commented 3 years ago

Added it: https://github.com/ManeraKai/simplytranslate_mobile/actions/runs/1312741439

Valdnet commented 3 years ago

The The translation input is above 5000 information should only be displayed once when you exceed the 5000-character limit while typing or pasting text. It should not show up when deleting text.

This is a bit annoying for the user as the message is displayed multiple times.

ManeraKai commented 3 years ago

Fixed that.

Valdnet commented 3 years ago

A test version, please 😉.

ManeraKai commented 3 years ago

https://github.com/ManeraKai/simplytranslate_mobile/actions/runs/1313043971

Valdnet commented 3 years ago

There is a bug. A message appears after the text has been copied and the letter deleted. It shouldn't be there.

Procedure:

Only the message appears when:

1. Typing a character >5000, that is, at 5001. Next does not appear anymore.

Example: 5000 + 1 = 5001 (message appears) + 1 (message no longer appears)

2. Text is pasted that exceeds 5000 characters.

Example: 2500 + 2501 = 5001 (message appears) + 200 (message no longer appears)

ManeraKai commented 3 years ago

So you want the message to just appear once and never again?

Valdnet commented 3 years ago

Yes. This is an additional option anyway. The character counter (it is red) informs about exceeding the character limit. A single message about exceeding the character limit is enough.

ManeraKai commented 3 years ago

Did that: https://github.com/ManeraKai/simplytranslate_mobile/actions/runs/1313594768

Valdnet commented 3 years ago

Should be corrected: No message appears when you enter text for the first time after deleting 1 character and re-entering the character. It appears only after deleting 2 characters and re-entering the character.

This only happens the first time you enter the text and after translating and deleting the text.

Current behavior example: 5010 (message appears) - 1 + 1 (there is no message, but it should appear) + 1 + 1 5010 (message appears) - 2 + 1 (message appears) + 1 + 1 5010 (message appears) - 1 + 1 (message appears) + 1 + 1

An example of correct operation: 5010 (message appears) - 1 + 1 (message appears) + 1 + 1 5010 (message appears) - 2 + 1 (message appears) + 1 + 1

ManeraKai commented 3 years ago

Fixed that: https://github.com/ManeraKai/simplytranslate_mobile/actions/runs/1315058780

Valdnet commented 3 years ago

Works correctly 👍. If I find a problem I will reopen the issue 😉.

ManeraKai commented 3 years ago

Translations....

Valdnet commented 3 years ago

Ah yes.

@Aga-C Will you deal with translations?

Aga-C commented 3 years ago

@Aga-C Will you deal with translations?

Sorry, I don't have time to work on this project. If it's a translation in a lang file, you can do this @Valdnet. If there's a hard-coded string in a code, then @ManeraKai should use a translatable one.

ManeraKai commented 3 years ago

No worries. I'll extract the strings for you @Valdnet.

Valdnet commented 3 years ago

@Aga-C Thanks for the information 😉.

I'll extract the strings

@ManeraKai Thanks 👍. I'm waiting 😁.

Valdnet commented 3 years ago

After tapping the character counter icon, the background is too large for the icon size. Bottom padding should be removed.

obraz

obraz

ManeraKai commented 3 years ago

I did that intentionally to make it as every other button:

Which one?

Valdnet commented 3 years ago

The character counter icon is now in the right place after adding information. It works as a button, only when you tap on the icon, the background of the icon is too large compared to the icon. I know you have a color problem on your monitor and you may not be able to see it. See it again:

obraz

😁

Valdnet commented 3 years ago

I changed the background color for the tap so you can see the size.

obraz

It should be this size:

obraz

ManeraKai commented 3 years ago

Fixed it, but I'll push the commit with the translation. Btw, I'm trying to add variables to translation strings, but didn't find a documentation for that. Trying to find it.

ManeraKai commented 3 years ago

Didn't find a proper native solution. Implemented it manually.

ManeraKai commented 3 years ago

I'll add the Arabic translation with your @Valdnet merge request. Don't merge it too quickly.

Valdnet commented 3 years ago

In these strings, the variables should be pulled out of the translation. This will make the translation easier for future translators and make it possible not to make mistakes.

https://github.com/ManeraKai/simplytranslate_mobile/blob/298865e6b32a1c617ea1254306a0b7b51d774197/lang/main_en.arb#L123-L124

Example:

"input_calc": "Exceeded 5000 character limit by %1", "input_fraction": "Entered %1 characters out of 5000 possible",

ManeraKai commented 3 years ago

You've added a variable too %1?

ManeraKai commented 3 years ago

Do you want to simplify variable names or add a percent sign instead of $ to declare a variable?

Valdnet commented 3 years ago

I want the variables to be replaced with a % or $ sign in the translation. No matter how easier it is for you. In dependencies, as the code allows 😉.

ManeraKai commented 3 years ago

"input_calc": "Exceeded 5000 character limit by $lengthDifference", "input_fraction": "Entered $length characters out of 5000 possible", ?

ManeraKai commented 3 years ago

I'm adding names to let the user know what that variable is talking about for translating purposes.

ManeraKai commented 3 years ago

Changed them.

Valdnet commented 3 years ago

Add singular and plural to the text string:

Entered $inputLength characters out of 5000 possible

characters must decay into singular and plural, e.g .:

one: Entered $inputLength character out of 5000 possible
few: Entered $inputLength characters out of 5000 possible
many: Entered $inputLength characters out of 5000 possible
other: Entered $inputLength characters out of 5000 possible
ManeraKai commented 3 years ago

When you should say it's many? After 10?

Valdnet commented 3 years ago

When you should say it's many? After 10?

There is a lot already at 5, that is: 5 characters.

For:

one: 1
few: 2-4
many: 5, 6, 7, 8, 9, 10, 11 …
Valdnet commented 3 years ago

Translation made in PR: #119.

Valdnet commented 3 years ago

For a light theme, the character count icon should now be green (theme color). It now looks like it is inactive.

ManeraKai commented 3 years ago

?

Valdnet commented 3 years ago

Cool 👍. I close the issue.

Aga-C commented 2 years ago

@ManeraKai The toasts are disappearing too quickly, and it's hard to read the longer texts. I mean, all toasts in the app should behave consistently. I think, 2 seconds will be enough.