cessda / cessda.cvs.two

Apache License 2.0
0 stars 2 forks source link

UI mixes two languages for TL admins #327

Closed cessda-bitbucket-importer closed 2 years ago

cessda-bitbucket-importer commented 3 years ago

Original report on BitBucket by Taina Jääskeläinen.


When a person with TL admin role uses the system, it mixes the Target language and Source language in the UI. The UI should be in English only.

It was only translated to certain languages in the beginnning, just to test that UI translation can be done as it was a requirement.

For example, a person with TL FI admin role:

  1. When the TL admin has been logged in, the system shows the name on top right, with a drop-down list next to the name with options Settings, Password and Sign out. However, the TL gets these options in the local language. See MicrosoftTeams-image (2) for this.
  2. In the 'Edit TL' pop-up, the button 'Close' is in English but the button 'Save' is in Finnish (Tallenna). When trying to close the window without giving obligatory information, the system gives an alert in Finnish. Same problem with ‘Edit code' and 'Add translation' pop-up. See an example in MicrosoftTeams-image (1) for the ‘Edit code’ pop-up where 'Save’ button is in Finnish.
  3. When clicks on 'Review' button for changing status, the system gives notice: 'Version is päivitetty'. The first word is in English, the rest in Finnish.
  4. In the ‘Home' page, on the blue line in the upper page, she has the 'Home’ tab name in Finnish (Etusivu) while the other tab names are in English. See MicrosoftTeams-image (4) for this.
  5. In Profile page (I assume it is the profile page where the user can change their personal details) the element names are in the local language. See MicrosoftTeams-image (3) for this.

Henri and me as content admins only have English in the UI.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


  <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
  <div class="mask"></div>
</div>

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


Work is in progress

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@‌TainaFSD just to clarify this issue. At the end all buttons and menus should be in English, right? Another question is, what should appear in the local language? Let’s say if user change the password, the notification should be in local language and also other system messages? Or what else should/shouldn’t be translated? In this example I already change the menus to be only in English, but what to do with other texts?

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


The whole user interface should be in English, all buttons, all menus as well as all notifications. If there is a change in notification, translating the notification to all local languages would take a long time and hinder the process considerably.

In the local language, only content within elements, produced by the user themselves.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


We have two options how-to solve this issue:

  1. We need to replace in all templates generating user interfaces (menus, buttons, labels, notifications, …) the tag “jhiTranslate”.
  2. We will replace other language translations by the English version of the user interfaces.

Both approaches have their pros and cons.

  1. Solution is cleaner, but we need to correct at least 1017 lines (it can be done by script, but there may be problems), but on the other hand, if we want to revert back to local languages, it will be really hard to find every line, where should be the translated string.
  2. Solution looks little bit as a hack, but in case that we want to support in the future user interfaces in different languages, it will be really easy to enable this solution, it will enough only to translate these languages and everything will work out of the box.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


Ideally, the solution would support the user interfaces in different languages, in case in the future an organisation would like to use the system in a national context.

CESSDA has decided to provide the UI in English only but the provision for different languages is made for other potential users.

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


Re solution 2, this requires that all the messages_xx.properties files (except messages_en.properties) in /src/main/resources/i18n have their contents replaced by the content of messages_en.properties.

If this is done as a single, stand-alone commit (and the commit hash is recorded in this issue), then it can be undone in the future by reversing the commit. I think this is cleaner and will be easier to reverse than solution 1 (provided no changes are made to the contents of messages_en.properties prior to reversing the commit).

At present, the scope of the contents of these files is:

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


Actually, it’s not only these files. Also everything inside this folder: https://github.com/cessda/cessda.cvs.two/blob/master/src/main/webapp/i18n/ . Taina is talking about menus, buttons, notifications and so on. They are defined in this folder. Let’s look for example in the Finnish section. The global.json is responsible for the main menu, buttons, notifications, and so on:

{
  "global": {
    "title": "Cvs",
    "browsehappy": "Käytät <strong>vanhentunutta</strong> selainta. Ole hyvä ja <a href=\"http://browsehappy.com/?locale=en\">päivitä selaimesi</a> parempaa käyttökokemusta varten.",
    "menu": {
      "home": "Etusivu",
      "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)",
      "entities": {
        "main": "Entiteetit",
        "vocabulary": "Vocabulary",
        "code": "Code",
        "version": "Version",
        "concept": "Concept",
        "conceptChange": "Concept Change",
        "activityLog": "Activity Log",
        "licence": "Licence",
        "metadataField": "Metadata Field",
        "metadataValue": "Metadata Value",
        "resolver": "Resolver",
        "vocabularyChange": "Vocabulary Change",
        "agency": "Agency",
        "userAgency": "User Agency",
        "jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)"
      },
      "account": {
        "main": "Tili",
        "settings": "Asetukset",
        "password": "Salasanat",
        "sessions": "Sessiot",
        "login": "Kirjaudu sisään",
        "logout": "Kirjaudu ulos",
        "register": "Rekisteröidy"
      },
      "admin": {
        "main": "Hallinto",
        "userManagement": "Käyttäjähallinta",
        "tracker": "User tracker",
        "metrics": "Metriikat",
        "health": "Terveys",
        "configuration": "Konfiguraatio",
        "logs": "Logit",
        "audits": "Audit logit",
        "apidocs": "API",
        "database": "Tietokanta",
        "jhipster-needle-menu-add-admin-element": "JHipster will add additional menu entries here (do not translate!)"
      },
      "language": "Kieli"
    },
    "form": {
      "username.label": "Käyttäjänimi",
      "username.placeholder": "Käyttäjänimesi",
      "currentpassword.label": "Nykyinen salasana",
      "currentpassword.placeholder": "Nykyinen salasana",
      "newpassword.label": "Uusi salasana",
      "newpassword.placeholder": "Uusi salasana",
      "confirmpassword.label": "Uuden salasanan vahvistus",
      "confirmpassword.placeholder": "Vahvista uusi salasana",
      "email.label": "Sähköposti",
      "email.placeholder": "Sähköpostisi"
    },
    "messages": {
      "info": {
        "authenticated": {
          "prefix": "Jos haluat ",
          "link": "kirjaudu sisään",
          "suffix": ", voit koittaa käyttää oletustilejä:<br/>- Administrator (login=\"admin\" ja salasana=\"admin\") <br/>- User (login=\"user\" ja salasana=\"user\")."
        },
        "register": {
          "noaccount": "Eikö sinulla ole vielä tiliä?",
          "link": "Rekisteröi uusi tili"
        }
      },
      "error": {
        "dontmatch": "Salasana ja sen vahvistus eivät ole samoja!"
      },
      "validate": {
        "newpassword": {
          "required": "Salasana on pakollinen.",
          "minlength": "Salasanan tulee olla vähintään 4 merkin pituinen.",
          "maxlength": "Salasana ei voi olla pitempi kuin 50 merkkiä.",
          "strength": "Salasanan vahvuus:"
        },
        "confirmpassword": {
          "required": "Salasana on pakollinen.",
          "minlength": "Salasanan tulee olla vähintään 4 merkin pituinen.",
          "maxlength": "Salasana ei voi olla pitempi kuin 50 merkkiä."
        },
        "email": {
          "required": "Sähköposti on pakollinen.",
          "invalid": "Sähköpostisi ei ole validi.",
          "minlength": "Sähköpostisi tulee olla vähintään 5 merkin pituinen.",
          "maxlength": "Sähköpostisi ei voi olla pitempi kuin 50 merkkiä."
        }
      }
    },
    "field": {
      "id": "ID"
    },
    "ribbon": {
      "dev": "Kehitys"
    },
    "item-count": "Näytetään {{first}} - {{second}} yhteensä {{total}}."
  },
  "entity": {
    "action": {
      "addblob": "Lisää blob",
      "addimage": "Lisää kuva",
      "back": "Takaisin",
      "cancel": "Peruuta",
      "delete": "Poista",
      "edit": "Muokkaa",
      "open": "Avaa",
      "save": "Tallenna",
      "view": "Lue"
    },
    "detail": {
      "field": "Kenttä",
      "value": "Arvo"
    },
    "delete": {
      "title": "Vahvista poistaminen"
    },
    "validation": {
      "required": "Tämä kenttä on pakollinen.",
      "minlength": "Tämän kentän tulee olla vähintään {{ min }} merkin pituinen.",
      "maxlength": "Tämä kenttä voi olla enintään {{ max }} merkkiä.",
      "min": "Tämän kentän tulee olla vähintään {{ min }}.",
      "max": "Tämä kenttä voi olla enintään {{ max }}.",
      "minbytes": "Tämän kentän tulee olla vähintään {{ min }} tavua.",
      "maxbytes": "Tämä kenttä voi olla enintään {{ max }} tavua.",
      "pattern": "Tämän kentän tulee olla muotoa {{ pattern }}.",
      "number": "Tämän kentän tulee olla numero.",
      "datetimelocal": "Tämän kentän tulee olla pvm ja aika.",
      "patternLogin": "Tämä kenttä voi sisältää kirjaimia, numeroita ja sähköpostiosoitteita."
    }
  },
  "error": {
    "internalServerError": "Palvelinvirhe",
    "server.not.reachable": "Palvelinta ei voida tavoittaa",
    "url.not.found": "Ei löytynyt",
    "NotNull": "Kenttä {{ fieldName }} ei voi olla tyhjä!",
    "Size": "Kenttä {{ fieldName }} ei täytä minimi ja maksimi kokorajoituksia!",
    "userexists": "Käyttäjänimi on jo käytössä!",
    "emailexists": "Sähköposti on jo käytössä!",
    "idexists": "Uusi {{ entityName }} ei voi sisältää ID:tä",
    "idnull": "ID virheellinen",
    "file": {
      "could.not.extract": "Could not extract file",
      "not.image": "File was expected to be an image but was found to be \"{{ fileType }}\""
    }
  },
  "footer": "Tämä on footer teksti"
}

As you can see there are lot of not translated lines (still in English). Already translated lines probably comes directly from i18 language packs, but the specific ones are not translated e.g.: "conceptChange": "Concept Change", "could.not.extract": "Could not extract file", .... So this is really crucial question, what to do and how it should be done. Another thing is that this language mix is not only for TL Admins, but actually it will be mixed for everyone who choose different language than English. For example Italian (it is the only one) version has the Home defined a Home: https://github.com/cessda/cessda.cvs.two/blob/master/src/main/webapp/i18n/it/global.json

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


Thanks for the clarification, I wasn’t aware of the src/main/webapp/i18n directory.

So the fix would be to copy the contents of src/main/webapp/i18n/en to src/main/webapp/i18n/xx (excluding xx =en, of course).

Again, if combined with the above proposed changes to the messages_xx.properties files, the commit could be reverted in the future. In essence, these are content not code-level changes, so less likely to introduce behavioural abnormalities if reverted en-masse in the future.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


Yes that’s true. In the meantime I found another error in the https://github.com/cessda/cessda.cvs.two/blob/085b521c7850baa3a45eb928582cec47d4e6d3a8/src/main/webapp/app/layouts/navbar/navbar.component.html#lines-128. It is only misspelled translation tag, I will create a new branch after I commit this one, with only this correction.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@john-shepherdson In the meantime another thing crosses my mind. Why will we leave the language selection in the account settings? It will have no meaning at all after these changes.

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


If the language selection in the account settings only affects the UI language settings, then it is redundant and should be removed. If it is used to specify the Target Language that the TL Admin produces translations in, then is should remain, and the label should be changed to be more explicit.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


I think (this is a global setting) it is only for user interfaces, but I will investigate it and let you know.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


Just to summarize the discussion: @Joshocan I will need the production MySQL database dump, please build one for me. Another thing is, where should be stored the ENVIRONMENTAL parameters? Not to be mixing several sources for the ENVIRONMENTAL variables. First I will examine the database and looks for users, which use other languages for UI and then I will think about the easiest and most advance solution for other UI languages versions.

cessda-bitbucket-importer commented 2 years ago

Original comment by Joshua Tetteh Ocansey (GitHub: Joshocan).


Database sent to IISAS.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


Can you attach the file as an attachment? You can do this by clicking on the ‘More’ button on top right. In the drop-down list you’ll find the ‘Attach file’ function.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


Sure, I didn't notice that there is attach file in the More button.

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


@pakoselo I’ve deleted your previous comment, screenshot and attachments are there is the potentially to disclose sensitive information (names and email addresses). I’ve attached a redacted screenshot.

Martin S wrote

So I will continue with the status of the process. In the attached Excel file (“K” column), you can see that, there are quite a lot of people using German, Swedish, … languages. I can see that John has two accounts there and also others are there few times replicated. So we need to leave it as it is and think of using ENV variables to allow the default language or localized versions. My question is, if it should be defined during building of the containers, or it should be ENV variable of the CVS app (during starting the web service, do we have something like this?)? Or should I investigate it by myself? It will took me some time.

Re env variable, we usually set such variables at deployment time.

@‌Matthew Morris

were is the best place to set the default UI language for CVS? (it is currently a per-user flag in the database)

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


@‌TainaFSD I suggest you review the user list when you have a moment. There are likely to be duplicates, redundancies and mis-assignment of roles. For a start, I should not have an account (nor should Joshua, Matthew, Sigit and other technical people).

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@john-shepherdson I am re posting your question, because I am not sure @matthew-morris-cessda gets it.

Re env variable, we usually set such variables at deployment time.

@matthew-morris-cessda were is the best place to set the default UI language for CVS? (it is currently a per-user flag in the database as seen in the above figure)

cessda-bitbucket-importer commented 2 years ago

Original comment by Matthew Morris (GitHub: matthew-morris-cessda).


The best method to set the default UI language would be an environment variable, which then could be overridden by a per-user preference.

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


Which should be set at deployment time, so there is no need to recompile the code in order to change the default value.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@‌TainaFSD @john-shepherdson @matthew-morris-cessda

I think we are moving in the circles. I will try to summarize the problem.

If we want to have default language, it will be instance/deployment based.

  1. In case, somebody will deploy new instance of CESSDA vocabularies, he/she can decide if there will be only default language (English). After that the language options in the user settings will be disabled (there should be check in the templates).
  2. If not, new users will have again English as a default language, but the language options will be enabled, so the user can choose whatever language wants. However, the localized versions will be mixed!
  3. Is it worth the effort, we put in?

My question is, why to support it and not to asks users or choose some of the users as language masters, and they can do the menus/buttons/notifications translations?

  1. I can do the Slovak language. Actually there is one lady from Slovenia, with Slovak language, but this is probably a mistake. If she is OK with that, why we should redevelop the wheel and not to update the languages.
  2. We can do the dirty hack with overriding all language template files, disable the laguage button in one commit and that’s it.
  3. We can support only English at all.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


Martin, I finally got what you mean (I hope). In fact, I have never understood the two language choices in the admin interface. In my opinion, the only language choice in admin relating to a user should be the one connected to the specific role(s) assigned to him/her (e.g. TL role for a specific agency and language)

I only now realised that the other language notationin the Admin seems to be related to the UI. Since CESSDA offers the UI in English only, CVS should not have any UI-related language choices/tags in the admin but the default should be English. So disabling this language choice is OK. CESSDA should not even allow users to choose anything else except English for UI language in the CESSDA-provided service.

The thing to consider then is then if, for instance, some organisation in Germany wants to implement the software in their own IT environment, they can translate the UI to German for their own needs. If their developers can manage somehow that the UI translation can be done there, all is OK.

Hope this helps and I did not misunderstand the issue.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@‌TainaFSD I think you summarize it pretty well. My question is (as I didn’t go through every UI page): are there any other place where we deal with language option? I am putting several interfaces, where I found the language option.

So to me it seems that we have two options:

  1. Use the default language (USE_DEFAULT_LANG=TRUE) environment variable., which should be set to true by default. This will hide the language option on the 1st and 2nd figure. If it will be set to false, these options will be visible.
  2. The second approach is to use the DEFAULT_LANG='en, es, ...' as environment variable and if the user will be created - it will prefill this value in the language option (1st figure).

On the 2nd figure are the settings for the current logged user (UI interface will be changed and this is initially set to the value admin uses when creating the user - 1st figure).

3rd figure is about specific roles and language is referred as target or source (this option will be there in any case).

@john-shepherdson can you please review the approaches please?

@matthew-morris-cessda the environmental variables are the ones defined in the src/main/resources/config folder?

cessda-bitbucket-importer commented 2 years ago

Original comment by Matthew Morris (GitHub: matthew-morris-cessda).


Yes, src/main/resources/config will set application configuraion.

See https://docs.spring.io/spring-boot/docs/2.2.7.RELEASE/reference/html/spring-boot-features.html#boot-features-external-config for documentation on how to set configuration variables in Spring Boot.

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


I think a combination of 1 & 2 will give us what we need.

USE_DEFAULT_LANG=TRUE (language field is set to default value and is read only in screens 1 & 2)

USE_DEFAULT_LANG=FALSE (language field is visible and writable/selectable in screens 1 & 2) [Why is it free text in screen 1 and a list in screen 2 though?]

DEFAULT_LANG='xx' is used to set the default, (does not have to English) and can be overwritten for individual users if USE_DEFAULT_LANG=FALSE

AVAILABLE_LANG='xx' (list of languages to use in screens 1 and 2) - this should reduce the number of possible error conditions


Use Case 1: CESSDA instance

UI is in English for all users (=> only English translation of resources required)

USE_DEFAULT_LANG=TRUE

DEFAULT_LANG='en'

AVAILABLE_LANG='en'


Use Case 2: EKKE own-use instance

UI is in Greek for all users (=> only Greek translation of resources required)

USE_DEFAULT_LANG=TRUE

DEFAULT_LANG='el'

AVAILABLE_LANG='el'


Use Case 3: FORS own-use instance

UI is in  German, French, Italian or Romansh (=> 4 translations of resources required), set on a per user basis.

USE_DEFAULT_LANG=FALSE

DEFAULT_LANG='de' (or ‘fr’ or ‘it’ or ‘rm’) [doesn’t matter which is used, as it can be overwritten]

AVAILABLE_LANG='de', ‘fr’, ‘it’, ‘rm’


There needs to be some error handling for:

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@john-shepherdson [Why is it free text in screen 1 and a list in screen 2 though?] This also a list, but the default option is empty (you need to choose something from the drop down menu). You can see the symbol of drop down menu on the right.

To me, the AVAILABLE_LANG is not necessary, but it can be. The problem with this settings is that they are defined in the configuration files and checks should be done before deployment. The problem with missing default lang in the list of available lang can be solved by adding it automatically in the code and we don’t need to take care about that in the deployment phase.

The checks for the resource files of the defined (available) language definitely must be done during deployment, but this seems to me too complicated.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


Another idea cross my mind. To simplify the problems with checking (this will take too much developing time), if the language files are not present, the system switch back to DEFAULT_LANG. So we will need only to check the DEFAULT_LANG at the deploying time.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


  1. Taina cleans the production admin user table. Lets IISAS know when this is done.
  2. Make EN the default UI language for existing and future users for 2.1.0
  3. Update the table with English as default language.

The rest can be considered for 3.0.0.

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


Update lang_key to en in all cases

cessda-bitbucket-importer commented 2 years ago

Original comment by John Shepherdson (GitHub: john-shepherdson).


Then treat this as a feature request, to be addressed in a later release.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


I have now updated the User table in production, leaving only those working wth content roles.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@Joshocan Can I ask you again for the dump of the production/staging/dev databases please? I want to prepare script(s), to update the users languages. First we will test it on the dev and staging, but to be sure, it will be safe to use it also int the production later. Thanks in advance

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


Yes, it will be good to test.

Have to check that changes in that changes in the UI language do not affect translator rights, that is, their getting the right buttons for translation.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@‌TainaFSD I almost 100% sure, that it will not affect their rights, because as you or some others have the English as UI language and you don’t have problems with the rights.

Just to inform everybody. There is already hard coded the default language as English, so when there will be no language selected during user creation it will be automatically changed to English. It is also automatically added to the user table. Users without language (NULL), were probably created before this functionality was developed. But it also deal with the NULL values.

This means, that no action is required in the database, but to be clean, I will prepare the scripts also to update the NULL values, not only the other languages to English. In the meantime I already disabled the language selection in the admin UI. This will affect the functionality in the “Users” form: there will be no column “Language“ (this is the UI language, and it is not necessary anymore). And also in the form “Create or edit a user” as it is the same case.

cessda-bitbucket-importer commented 2 years ago

Original comment by Martin Šeleng (GitHub: pakoselo).


@Joshocan Can you please run this code:

USE cvs;
SET SQL_SAFE_UPDATES=0;
UPDATE jhi_user SET lang_key = "en";

on the staging please? So @‌TainaFSD can check if everything works as it should. Thanks

cessda-bitbucket-importer commented 2 years ago

Original comment by Joshua Tetteh Ocansey (GitHub: Joshocan).


@pakoselo Staging database is updated. @‌TainaFSD you can check now.

cessda-bitbucket-importer commented 2 years ago

Original comment by Taina Jääskeläinen.


Admin in staging has the default EN for UI language choice. I asked a person with only translator rights to take a quick look, seemed buttons were in English. So this seems to be resolved.