vendredi 6 décembre 2019

Django selenium: i18n partially works

I currently develop a Django project and have a functional test using selenium. It was running until I internationalize my app. I do not understand why some 'send_keys' correctly use the translation but other do not.

I try to find out how different are input that do not work but can't find.

test.py

from django.utils.translation import ugettext_lazy as _
# from django.utils.translation import ugettext as _

def test_randomisation(self):
        self.selenium.find_element_by_xpath('//*[@id="navbarSupportedContent"]/ul[1]/li[5]/a').click()
        PatientCode = self.selenium.find_element_by_xpath('//*[@id="table_id"]/tbody/tr[1]/td[1]').text
        self.selenium.find_element_by_xpath('//*[@id="table_id"]/tbody/tr[1]/td[4]/a').click()
        PatientCodeFormulaire = self.selenium.find_element_by_xpath('/html/body/div[1]/div[1]/div[1]').text
        self.assertEqual(PatientCodeFormulaire[14:24],PatientCode)

        ran_inv = self.selenium.find_element_by_xpath('//*[@id="id_ran_inv"]') 
        ran_inv.send_keys('Slater')
        ran_pro = self.selenium.find_element_by_xpath('//*[@id="id_ran_pro"]')

        **ran_pro.send_keys(_('On-line'))**  # problem here

        ran_pro_per = self.selenium.find_element_by_xpath('//*[@id="id_ran_pro_per"]')
        ran_pro_per.send_keys('Iron')
        ran_crf_inc = self.selenium.find_element_by_xpath('//*[@id="id_ran_crf_inc"]')

        **ran_crf_inc.send_keys(_('Yes'))** # problem here

        ran_tbc = self.selenium.find_element_by_xpath('//*[@id="id_ran_tbc"]')
        ran_tbc.send_keys(_('Possible'))
        ran_crf_eli = self.selenium.find_element_by_xpath('//*[@id="id_ran_crf_eli"]')

        **ran_crf_eli.send_keys(_('Yes'))** # problem here

        ran_cri = self.selenium.find_element_by_xpath('//*[@id="id_ran_cri"]')

        **ran_cri.send_keys(_('Yes'))** # problem here

        ran_sta = self.selenium.find_element_by_xpath('//*[@id="id_ran_sta"]')
        ran_sta.send_keys(_('Mild'))
        ran_vih = self.selenium.find_element_by_xpath('//*[@id="id_ran_vih"]')
        ran_vih.send_keys(_('Negative'))

django.po

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-06 10:03+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: .\intenseTBM_eTool\settings.py:160
msgid "English"
msgstr "Anglais"

#: .\intenseTBM_eTool\settings.py:161
msgid "French"
msgstr "Français"

#: .\randomization\forms.py:11 .\randomization\tests.py:334
msgid "On-line"
msgstr "En ligne"

#: .\randomization\forms.py:12
msgid "Telephon"
msgstr "Par téléphone"

#: .\randomization\forms.py:17
#: .\randomization\templates\randomization\randomisation_edit.html:63
#: .\randomization\tests.py:338 .\randomization\tests.py:342
#: .\randomization\tests.py:344
msgid "Yes"
msgstr "Oui"

#: .\randomization\forms.py:18
#: .\randomization\templates\randomization\randomisation_edit.html:62
msgid "No"
msgstr "Non"

#: .\randomization\forms.py:23 .\randomization\tests.py:340
msgid "Possible"
msgstr "Possible"

#: .\randomization\forms.py:24
msgid "Probable"
msgstr "Probable"

#: .\randomization\forms.py:25
msgid "Definite"
msgstr "Certain"

#: .\randomization\forms.py:30 .\randomization\tests.py:346
msgid "Mild"
msgstr "Modérée"

#: .\randomization\forms.py:31
msgid "Severe"
msgstr "Sévère"

#: .\randomization\forms.py:36 .\randomization\tests.py:348
msgid "Negative"
msgstr "Négatif"

#: .\randomization\forms.py:37
msgid "Positive"
msgstr "Positif"

#: .\randomization\forms.py:40
#: .\randomization\templates\randomization\index.html:23
#: .\randomization\templates\randomization\randomisation_edit.html:24
msgid "Patient code"
msgstr "Code Patient"

#: .\randomization\forms.py:58
msgid "Date of randomization"
msgstr "Date de randomisation"

#: .\randomization\forms.py:64
msgid "Investigator"
msgstr "Investigateurs "

#: .\randomization\forms.py:65
msgid "Type"
msgstr "Type"

#: .\randomization\forms.py:66
msgid "if telephone, name of the person reached on the phone"
msgstr "Si téléphone, nom de la personne jointe au téléphone"

#: .\randomization\forms.py:67
msgid "Was the CRF inclusion 1 TB diagnosis fulfilled?"
msgstr "Le CRF inclusion 1 Diganostic TB a-t-il été rempli ?"

#: .\randomization\forms.py:68
msgid "Was the CRF Inclusion 2 Eligibility fulffiled?"
msgstr "Le CRF inclusion 2 Eligibilité a-t-il été rempli ?"

#: .\randomization\forms.py:69
msgid "Is TB diagnosis possible, probable or definite?"
msgstr "Le diagnostic de MTB est-il possible, probable ou certain ?"

#: .\randomization\forms.py:70
msgid "Is the conclusion All criteria fulfilled for randomisation"
msgstr ""
"La conclusion est-elle 'Tous les critères de randomisation sont remplis' ? "

#: .\randomization\forms.py:71
msgid ""
"British Medical Council Staging (worst stage reported between first symptoms "
"and now)"
msgstr ""
"Classification du british medical research council (le pire stade signalé "
"entre les premiers symptômes et maintenant)"

#: .\randomization\forms.py:72
msgid "HIV/AIDS status"
msgstr "Statut VIH/SIDA"

#: .\randomization\forms.py:82 .\randomization\forms.py:89
msgid "This criteria is mandatory for randomization"
msgstr "Ce critère est obligatoire pour la randomisation"

#: .\randomization\models.py:37
#: .\randomization\templates\randomization\confirmation.html:18
#: .\randomization\views.py:205
msgid "WHO Standard TBM treatment"
msgstr "Traitement TBM OMS standard"

#: .\randomization\models.py:39
#: .\randomization\templates\randomization\confirmation.html:20
msgid "Intensified TBM treatment"
msgstr "Traitement TBM intensifié"

#: .\randomization\templates\randomization\confirmation.html:5
#: .\randomization\templates\randomization\index.html:7
#: .\randomization\templates\randomization\randomisation_edit.html:14
#: .\templates\layouts\_nav.html:52
msgid "Randomization"
msgstr "Randomisation"

#: .\randomization\templates\randomization\confirmation.html:11
msgid "Patient number"
msgstr "Patient"

#: .\randomization\templates\randomization\confirmation.html:11
msgid "randomized"
msgstr "randomisé"

#: .\randomization\templates\randomization\confirmation.html:12
msgid "Print"
msgstr "Imprimer"

#: .\randomization\templates\randomization\confirmation.html:15
msgid "Randomization date:"
msgstr "Date de randomisation : "

#: .\randomization\templates\randomization\confirmation.html:16
msgid "TB Treatment strategy:"
msgstr "Stratégie de traitement TB : "

#: .\randomization\templates\randomization\confirmation.html:23
msgid "Box number:"
msgstr "Numéro de lot : "

#: .\randomization\templates\randomization\confirmation.html:24
msgid ""
"\n"
"\t\t<p>The randomization process is complete.</p>\n"
"\t\t<p>Please write down the tuberculosis treatment and the box number "
"ASPIRINE / PLACEBO allocated on the CRF paper \"05-D0 RANDO\", sign it and "
"archive it in the patient's file</p>\n"
"\t"
msgstr ""
"\n"
"\t\t<p>Le processus de randomisation est terminé.  Merci de reporter le "
"traitement antituberculeux et le numéro de boite ASPIRINE/PLACEBO alloués "
"sur le CRF papier \"05-D0 RANDO\", de le signer et l'archiver dans le "
"dossier du patient</p>\n"
"\t"

#: .\randomization\templates\randomization\confirmation.html:29
msgid "Back to randomization"
msgstr "Retour à la randomisation"

#: .\randomization\templates\randomization\index.html:14
msgid "RANDOMIZATION INTENSE TBM STUDY ANRS 12398"
msgstr "RANDOMISATION ESSAI INTENSE TBM ANRS 12398"

#: .\randomization\templates\randomization\index.html:16
msgid ""
"\n"
"            <p style=\"color:#007bff;\">The randomization procedure should "
"only be performed by trained and authorized individuals. If there is a "
"problem call the [National Coordination phone number], or [International "
"coordination phone number].</p>\n"
"            "
msgstr ""
"\n"
"            <p style=\"color:#007bff;\">La procédure de randomisation ne "
"doit être réalisée que par des personnes formées et autorisées. En cas de "
"problème appelez le [numéro de téléphone de la coordination nationale], ou "
"[numéro de téléphone de la coordination internationale].</p>\n"
"            "

#: .\randomization\templates\randomization\index.html:24
msgid "TB Treatment"
msgstr "Traitement TB"

#: .\randomization\templates\randomization\index.html:25
msgid "Batch number"
msgstr "Numéro de lot"

#: .\randomization\templates\randomization\index.html:26
msgid "Actions"
msgstr "Actions"

#: .\randomization\templates\randomization\index.html:43
#: .\randomization\templates\randomization\randomisation_edit.html:45
msgid "Randomize"
msgstr "Randomiser"

#: .\randomization\templates\randomization\index.html:51
msgid "No records found"
msgstr "Aucun enregistrement correspondant"

#: .\randomization\templates\randomization\index.html:60
#: .\randomization\templates\randomization\randomisation_edit.html:53
msgid "Intense TBM Randomization"
msgstr "Randomisation Intense TBM"

#: .\randomization\templates\randomization\index.html:66
msgid ""
"\n"
"                <p style=\"color:red;\">This patient can not be randomized "
"because no drugs available at your pharmacy. Please contact your CTU.</p>\n"
"                "
msgstr ""
"\n"
"                <p style=\"color:red;\">Ce patient ne peut pas être "
"randomisé car il n'y a pas de médicaments disponibles dans votre pharmacie. "
"Veuillez contacter votre CCN.</p>\n"
"                "

#: .\randomization\templates\randomization\index.html:71
msgid "Close"
msgstr "Fermer"

#: .\randomization\templates\randomization\randomisation_edit.html:20
msgid "Randomization form"
msgstr "Formulaire de randomisation"

#: .\randomization\templates\randomization\randomisation_edit.html:27
msgid "Age"
msgstr "Age"

#: .\randomization\templates\randomization\randomisation_edit.html:30
msgid "Sex"
msgstr "Sexe"

#: .\randomization\templates\randomization\randomisation_edit.html:32
msgid "Male"
msgstr "Masculin"

#: .\randomization\templates\randomization\randomisation_edit.html:34
msgid "Female"
msgstr "Féminin"

#: .\randomization\templates\randomization\randomisation_edit.html:59
msgid "Do you confirm randomization of this patient?"
msgstr "Confirmez-vous la randomisation de ce patient ?"

#: .\randomization\views.py:197
#, fuzzy
#| msgid "RANDOMIZATION INTENSE TBM STUDY ANRS 12398"
msgid "INTENSE TBM ANRS 12398"
msgstr "RANDOMISATION ESSAI INTENSE TBM ANRS 12398"

#: .\randomization\views.py:198
msgid "Randomization form confirmation"
msgstr "Formulaire de randomisation"

#: .\randomization\views.py:207
msgid "Intensified TB treatment"
msgstr "Traitement TBM intensifié"

#: .\randomization\views.py:210
msgid "The randomization process is complete."
msgstr "Le processus de randomisation est terminé."

#: .\randomization\views.py:211
msgid ""
"Please write down the tuberculosis treatment and the box number ASPIRINE / "
"PLACEBO"
msgstr ""
"Merci de reporter le traitement antituberculeux et le numéro de boite "
"ASPIRINE/ PLACEBO"

#: .\randomization\views.py:212
msgid ""
"allocated on the CRF paper \"05-D0 RANDO\", sign it and archive it in the "
"patient's file."
msgstr ""
"alloués sur le CRF papier \"05-D0 RANDO\", de le signer et l'archiver dans "
"le dossier du patient."

#: .\randomization\views.py:213
msgid "Print date: "
msgstr "Date d'impression : "

#: .\randomization\views.py:214
msgid "User: "
msgstr "Utilisateur : "

#: .\randomization\views.py:222
msgid "Patient Code: "
msgstr "Code Patient"

#: .\randomization\views.py:223
msgid "Randomization date: "
msgstr "Date de randomisation : "

#: .\randomization\views.py:224
msgid "TB Treatment strategy: "
msgstr "Stratégie de traitement TB : "

#: .\randomization\views.py:225
msgid "Box number: "
msgstr "Numéro de lot : "

#: .\randomization\views.py:248
msgid "ITBM_randomization_confirmation_"
msgstr "Formulaire de randomisation"

#: .\registration\templates\registration\login.html:4
#: .\registration\templates\registration\login.html:15
#: .\templates\layouts\_nav.html:86
msgid "Login"
msgstr "Connexion"

#: .\registration\templates\registration\login.html:16
msgid "Forgotten password?"
msgstr "Mot de passe oublié ?"

#: .\registration\templates\registration\password_change_done.html:4
#: .\registration\templates\registration\password_change_form.html:4
#: .\registration\templates\registration\password_change_form.html:14
#: .\registration\templates\registration\password_reset_complete.html:4
#: .\registration\templates\registration\password_reset_confirm.html:4
#: .\registration\templates\registration\password_reset_confirm.html:10
#: .\registration\templates\registration\password_reset_done.html:4
#: .\templates\layouts\_nav.html:78
msgid "Change password"
msgstr "Modifier mot de passe"

#: .\registration\templates\registration\password_change_done.html:10
#: .\registration\templates\registration\password_reset_complete.html:10
msgid "Password modified"
msgstr "Mot de passe modifié"

#: .\registration\templates\registration\password_reset_complete.html:11
msgid "You can "
msgstr "Vous pouvez vous "

#: .\registration\templates\registration\password_reset_complete.html:11
msgid "login"
msgstr "connecter"

#: .\registration\templates\registration\password_reset_complete.html:11
msgid "again."
msgstr "à nouveau."

#: .\registration\templates\registration\password_reset_confirm.html:16
msgid "Save"
msgstr "Enregistrer"

#: .\registration\templates\registration\password_reset_confirm.html:19
msgid "Invalid token"
msgstr "Token invalide"

#: .\registration\templates\registration\password_reset_done.html:10
#: .\registration\templates\registration\password_reset_form.html:11
msgid "Password change request"
msgstr "Demande de modification de mot de passe"

#: .\registration\templates\registration\password_reset_done.html:11
msgid ""
"\n"
"\t\t\t\t<p>We've emailed you the instructions to change your password, as "
"long as an account exists with the address you specified.</p>\n"
"\t\t\t\t<p>You should receive this message quickly.</p>\n"
"\t\t\t\t<p>If you do not receive a message, check that you have entered the "
"address you registered with and check your spam folder.</p>\n"
"\t\t\t\t"
msgstr ""
"\n"
"\t\t\t\t<p>Nous vous avons envoyé par courriel les instructions pour changer "
"de mot de passe, pour autant qu'un compte existe avec l'adresse que vous "
"avez indiquée</p>\n"
"\t\t\t\t<p>Vous devriez recevoir rapidement ce message.</p>\n"
"\t\t\t\t<p>Si vous ne recevez pas de message, vérifiez que vous avez saisi "
"l'adresse avec laquelle vous vous êtes enregistré et contrôlez votre dossier "
"de pourriels.</p>\n"
"\t\t\t\t"

#: .\registration\templates\registration\password_reset_form.html:15
msgid "Confirm"
msgstr "Confirmer"

#: .\registration\validators.py:12
msgid "This password must contain at least 2 special characters."
msgstr "Votre mot de passe doit contenir au minimum 2 caractères spéciaux"

#: .\registration\validators.py:19
msgid "Your password must contain at least 2 special characters."
msgstr "Votre mot de passe doit contenir au minimum 2 caractères spéciaux"

#: .\templates\404.html:7
msgid "Patient does not exist"
msgstr "Ce patient n'existe pas"

#: .\templates\500.html:7
msgid ""
"\n"
"\t\t<p>An error occurs and you have been logout.</p> \n"
"\t\t<p>Please login again.</p>\n"
"\t\t"
msgstr ""
"\n"
"\t\t<p>Une erreur s'est produite et vous avez été déconnecté.</p> \n"
"\t\t<p>Merci de vous connecter à nouveau.</p>\n"
"\t\t"

#: .\templates\home.html:3
msgid "Homepage"
msgstr "Accueil"

#: .\templates\home.html:12
msgid ""
"\n"
"\tIntensified tuberculosis treatment to reduce the mortality of HIV-infected "
"and uninfected patients with tuberculosis meningitis: \n"
"\ta Phase III Randomized Controlled Trial \n"
"\t"
msgstr ""
"\n"
"\tTraitement intensif de la tuberculose pour réduire la mortalité chez les "
"patients infectés par le VIH et non infectés avec une tuberculose "
"méningée : \n"
"\t Essai randomisé de phase III \n"
"\t"

#: .\templates\home.html:18
msgid "Sponsor"
msgstr "Promoteur "

#: .\templates\home.html:20
msgid "Investigators"
msgstr "Investigateurs "

#: .\templates\layouts\_nav.html:16
msgid "Home"
msgstr "Accueil"

#: .\templates\layouts\_nav.html:20
msgid "eCRF"
msgstr "eCRF"

#: .\templates\layouts\_nav.html:23 .\templates\layouts\_nav.html:47
msgid "Dashboard"
msgstr "Tableau de bord"

#: .\templates\layouts\_nav.html:28
msgid "Patient"
msgstr "Patient"

#: .\templates\layouts\_nav.html:30
msgid "Calendar"
msgstr "Calendrier"

#: .\templates\layouts\_nav.html:32
msgid "Study follow-up"
msgstr "Suivi de l'étude"

#: .\templates\layouts\_nav.html:36 .\templates\layouts\_nav.html:39
msgid "Monitoring"
msgstr "Monitorage"

#: .\templates\layouts\_nav.html:41
msgid "Data"
msgstr "Données"

#: .\templates\layouts\_nav.html:43
msgid "Forms"
msgstr "Fiches"

#: .\templates\layouts\_nav.html:45
msgid "Discrepencies"
msgstr "Discordances"

#: .\templates\layouts\_nav.html:56
msgid "Export"
msgstr "Export"

#: .\templates\layouts\_nav.html:59
msgid "Adverse events"
msgstr "Evènements indésirables"

#: .\templates\layouts\_nav.html:62
msgid "Pharmacy"
msgstr "Pharmacie"

#: .\templates\layouts\_nav.html:65
msgid "Contact"
msgstr "Contact"

#: .\templates\layouts\_nav.html:80
msgid "Logout"
msgstr "Deconnexion"

Aucun commentaire:

Enregistrer un commentaire