FriendlyCaptcha / friendly-challenge

The widget and docs for the proof of work challenge used in Friendly Captcha. Protect your websites and online services from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution.
https://friendlycaptcha.com
MIT License
419 stars 62 forks source link

Add CZ, HR, HU, SK, SI, RS, BG, GR, EE, FI, LT, LV, NO, PL, RO, UA values to data-lang attribute #120

Closed Tubilopto closed 2 years ago

Tubilopto commented 2 years ago

Hello,

Could you please add CZ, HR, HU, SK, SI, RS, BG, GR, EE, FI, LT, LV, NO, PL, RO, UA values to data-lang attribute for respectively Czech, Croatian, Hungarian, Slovakian, Slovenian, Serbian, Bulgarian, Greek, Estonian, Finnish, Lithuanian, Latvia, Norwegian, Polish, Romanian and Ukrainian languages? We are in the middle of a big rollout and it would be amazing to have translations working for these languages :)

Best,

Tugba

merlinfuchs commented 2 years ago

We usually let native speakers do the translations for us. If you know anyone that speaks one of these languages they can always create a PR here. You can also provide your own translation when instantiating the widget. Maybe this is the better option here, because adding all these languages would also significantly increase the bundle size.

Tubilopto commented 2 years ago

Hello,

I can provide you the translations but what do you mean "that would increase the bundle size"? We would really appreciate if this could be done on your side since this will be used by different brands which are maintained on different platforms.

Thank you!

Tugba

dev-love commented 2 years ago

@merlinfuchs Maybe we can try to find a more efficient way of loading languages for the widget. The more languages we have, the better in general, I'd say. But of course this should not harm loading performance too much.

gzuidhof commented 2 years ago

How much does the bundle size increase

I guesstimate that every language we add adds around 500 bytes to the bundle, and 200 bytes to the bundle after gzip. These 16 languages listed here I assume would add 3.2kb or so to the file actually downloaded by end users. This is a significant increase (from around 12kb to 15kb for the non-polyfilled modern browser version).

But pragmatically 3kb isn't something to worry about. Our widget generally loads after the webpage loads so a 0.1 second longer load time isn't that critical. It hurts me to say that as we worked quite hard to get our stuff so small!

For comparison: Google ReCAPTCHA uses almost 1.5MB, a thousand times as much, and I wasn't even shown any challenge (so no challenge images were loaded), here's a screenshot of their demo page:

Screenshot 2022-06-22 at 17 36 20

How could we do it differently

In the future

We could include languages with a separate JS file that can be included that 'registers' the language for this library, that way website admins could include only those languages they are interested in. In a future (v2) widget we will also be able to load the languages on-demand as we are moving to more serverside 'rendering'.

Conclusion

I'm happy to include more languages as long as we can have confidence they are correct and came from a (near)-Native speaker. Google Translate powered translations usually do more harm than good (in most cases users are better off with English then)

Tubilopto commented 2 years ago

Hi everyone, thanks a lot for the support and clear explanations here! :) I will be providing the translations to you in the upcoming days, they will be translated by the markets themselves. Another questions is: would you like us to provide them as it is in the code? Maybe it would be easier for you to implement. Example:

`// English const LANG_EN: Localization = { text_init: "Initializing..",

text_ready: "Anti-Robot Verification", button_start: "Click to start verification",

text_fetching: "Fetching Challenge",

text_solving: "Verifying you are human..", text_completed: "I am human", text_completed_sr: "Automatic spam check completed",

text_expired: "Anti-Robot verification expired", button_restart: "Restart",

text_error: "Verification failed", button_retry: "Retry", text_fetch_error: "Failed to connect to", };`

merlinfuchs commented 2 years ago

Yeah, that would be the easiest option for us! Thanks a lot already!

Tubilopto commented 2 years ago

Hello,

Please find the necessary translations here: Friendly Captcha.txt

Thank you so much already!

Tubi

gzuidhof commented 2 years ago

This is now merged and published as part of version 0.9.5. In the end the extra bundle size is ~3KB:

Screenshot 2022-07-15 at 02 05 18
Tubilopto commented 2 years ago

Hello,

Thanks a lot for updating your database! :)

However, we are still seeing EN copies and get these errors below. Could you please check? image image

Best,

Tugba

gzuidhof commented 2 years ago

Hi Tugba,

Could you ensure you are on version 0.9.5? I am not able to reproduce the issue, here's a screenshot of a Czech widget.

Screenshot 2022-07-15 at 11 36 39

The version on NPM via a CDN looks to contain the new languages too:

Screenshot 2022-07-15 at 11 39 26

We will need to update the Wordpress plugin still with this latest version, are you using that by any chance?

Tubilopto commented 2 years ago

Hello Guido,

I understand the issue now; we are using 0.9.2 still. I'll update it.

But should we be always on top of new versions? Since this the link we are implementing on Sitecore, it would require us to always check if there is a new version, and update it. Is there any other way where you can update the version without us having to also update it?

https://unpkg.com/friendly-challenge@0.9.5/widget.module.min.js

Best,

Tugba

gzuidhof commented 2 years ago

We aim for the widget code to be as stable as possible, if the current version works for you then you shouldn't have to update the widget :) - but it's of course never a bad idea to update at least once a year or so. We have users using versions of the widget from one and a half year ago without issues - but they are missing out on some fixes and improvements.

We're working on version two of our captcha offering which will be served a bit differently, in that version we will be able to update parts in the background such as the localizations :).

Have a great weekend!

Tubilopto commented 2 years ago

I understand, thank you so much! :)

I have updated it to 0.9.5 in the backend but still the translations are not visible. Could you please check?

https://www.nivea.bg/#layer=contact-us

gzuidhof commented 2 years ago

I looked at the source code of the webpage, from the looks of it the version of the widget that is live is 0.9.0.

I imagine there is something internal to your organization that hasn't processed your update yet, so I'm afraid I can't provide useful pointers there. Maybe changes to production happen once per day or week? This is something the team that manage/deploy the Nivea websites can hopefully clear up for you

gzuidhof commented 2 years ago

When I was trying the different localizations I noticed that in some translations the button text ("button_start") overflows (here in Bulgarian):

Screenshot 2022-07-15 at 13 29 40

99% of people don't press (or even see) the button as it automatically starts solving when the form is clicked, so it's not the end of the world, but I would be happy to include changes to the localizations that make these button texts a bit shorter.


I think a maximum number of characters that fit is approximately:

The text could be something like "Click to start" or "Click to verify" instead of "Click to start verification" in languages that are a bit too wide.

Languages that could be shortened a bit:

Tubilopto commented 2 years ago

Thanks a lot Guido! We will check the translations after our internal bug is fixed.

Meanwhile, could you please update FI and DA languages?

Friendly Captcha SE,FI.txt

Thank you!

Tubi

gzuidhof commented 2 years ago

Re-opening this so we don't forget about this, thank you for the updated translations! :)

Tubilopto commented 2 years ago

Hello! I am opening this again because NO translation do not work from our side; all the other languages are fine: https://www.nivea.no/#layer=contact-us Could you please check?

merlinfuchs commented 2 years ago

You seem to be providing nb as the language code instead of no. Seems like both are valid language codes for norwegian, but no is the primary one. Changing it from nb to no should solve the issue. If this is a dealbreaker I think we can add nb as an alias for no.


The code "no" refers to any form of Norwegian, and "nb" refers to Bokmål, "nn" referring to Nynorsk which would definitely be inappropriate. The code "no" refers to any version of Norwegian so includes "nb" and "nn" as well as all other dialects, which don't have separate ISO codes. The code "nb" is more narrowly Bokmål.```
Tubilopto commented 2 years ago

It would require a lot of efforts from our side unfortunately. If adding nb as an alias for no is gonna work on the frontend, it would be amazing :) Thank you!

merlinfuchs commented 2 years ago

I have added nb as an alias for no. This will be part of the next update, but I'm not sure when we will be rolling it out

merlinfuchs commented 2 years ago

@gzuidhof will probably roll it out next week :)

Narminnnn commented 2 years ago

Hello everyone! :) I was checking https://www.nivea.no/#layer=contact-us and NO translation do not work still. Could you please check?

merlinfuchs commented 2 years ago

Please make sure you are using the most recent version of the widget. The nb alias for no is only available in the most recent version.