Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Invalid username error message is not translated #221

Open
goneall opened this issue Feb 25, 2022 · 4 comments
Open

Invalid username error message is not translated #221

goneall opened this issue Feb 25, 2022 · 4 comments

Comments

@goneall
Copy link
Collaborator

goneall commented Feb 25, 2022

When an invalid username is entered on the signup form, the message "Error!!!" is displayed rather than the error reported from the JavaScript.

This is likely an error in the translation.

This is the HTML for the displayed error:

<p class="translate" data-i18n="Length of address must be between 3 and 500">Error!!</p>
error

@goneall
Copy link
Collaborator Author

goneall commented Aug 5, 2022

The text is set in the updateTips method in navbar.js:

function updateTips( t ) {
    tips
      .html('<p class="translate" data-i18n="'+t+'">Error!!</p>')
      .addClass( "ui-state-highlight" );
    $('.translate').localize();
    setTimeout(function() {
      tips.removeClass( "ui-state-highlight", 1500 );
    }, 500 );
  }

It looks like the translate function is not rendering the text. Perhaps all of the error messages are not in the translations?

In the short term, we could just add the English error messages.

@goneall
Copy link
Collaborator Author

goneall commented Aug 5, 2022

It looks like the translation data for the string displayed is there but is not being displayed. Maybe the lookup is failing due to the special characters in the translation key?

Below is the key from the Japanese translation file for the sign-up error when the username is not correct:

  "Username may consist of a-z, 0-9, underscores, spaces and must begin with a letter": "ユーザー名は、a-z、0-9、下線、スペースで構成され、必ず文字で始めてください。",

@goneall
Copy link
Collaborator Author

goneall commented Aug 5, 2022

We could try replacing the key with something less complex.

Another possible solution would be to include the error text in the HTML, e.g.:

function updateTips( t ) {
    tips
      .html('<p class="translate" data-i18n="'+t+'">t</p>')
      .addClass( "ui-state-highlight" );
    $('.translate').localize();
    setTimeout(function() {
      tips.removeClass( "ui-state-highlight", 1500 );
    }, 500 );
  }

goneall added a commit that referenced this issue Aug 17, 2022
partial resolution for issue #221

Doesn't solve the translation of bad usernames, but it will display
the error in english.

Signed-off-by: Gary O'Neall <[email protected]>
@goneall
Copy link
Collaborator Author

goneall commented Aug 17, 2022

Partially resolved with PR #223 - the error will now display in English but will not translate to the local language

@goneall goneall changed the title Error message incorrect on Signup Page Invalid username error message is not translated Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant