Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] Re: french translations and javascript problem

Subject: Grouper Developers Forum

List archive

[grouper-dev] Re: french translations and javascript problem


Chronological Thread 
  • From: Yoann Delattre <>
  • To: Francis Bouchard-Boulianne <>, "Hyzer, Chris" <>, "" <>
  • Subject: [grouper-dev] Re: french translations and javascript problem
  • Date: Tue, 24 Apr 2018 15:47:18 +0200
  • Arc-authentication-results: i=1; auth=pass
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ac-lille.fr; s=aclille-dkim; t=1524577643; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yEtQ9z1ZiPl3MEzknOMSNulqGU+VaB/8L6CYnlx4T8c=; b=JKlznKaOAxjcKogh7aA/FO6Ryftw9itYYAjsTsOH+cCZkermFZ/F+CN4X0LzCCDALx51Qy CWSKweiGtftqYcvpj1gbmW52VHqHlyis7dKjlgHB2uW+Hmyq2pIZ4SQsyojdUMu+/pny2w b3DTDkEihZdaRhB0LX1Ugdpp5vMwfSI=
  • Arc-seal: i=1; s=aclille-dkim; d=ac-lille.fr; t=1524577643; a=rsa-sha256; cv=none; b=gfVCJaufSxLfbpx+ANB8Rub5DwE6UrD/KKfb/epipClzwxcec2npu34iPj8zTz00agjrEqNIK6LSXGorEkcgEEuVqocmOuHWt2xnco7ez8FltlJRS5lYLPOsgurRT1sKn8VUnIyW4Y9oSTxpcaPUA6Zg/iqZhEk0qI4yitd7KUw=
  • Authentication-results: auth=pass
  • Ironport-phdr: 9a23:kHmhFRzDROtt9W/XCy+O+j09IxM/srCxBDY+r6Qd0uoXKvad9pjvdHbS+e9qxAeQG9mDsLQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPbQhEniaxba9vJ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BMr1RxrMZJKFRUiOQ9O6DCs3Q85rhdICfhAuNc+li0Xy2COsBfc5mriCGIAu/+qIzn/4IcA7x3vC3bU9lVQOS8AKMWyigqM5+RKFVN2BqFmQi6v/LfdU5yXK7mrWiDPW5Ew=

Hi,

the first version had a little "split" problem.
in attached, the new version.

thanks,
Yoann
Le 24/04/2018 à 12:13, Yoann Delattre a écrit :

Hello,

in attached, a little script in python who basically do what Francis describe.
The script don't ask (yet) the name of the base file and so work only with french translation (unless you change the code) but it's a start :)

Just execute it in a folder where there is grouper.text.fr.fr.base.properties and grouper.text.en.us.base.properties and the result will be a new file (grouper.text.fr.fr.base.properties.new).
Also, it print the translations who are missing.

Thanks,

Yoann

Le 16/02/2018 à 02:10, Francis Bouchard-Boulianne a écrit :

Hi,

 

I will try to be as clear as I can.

 

The idea is to keep in synch the different languages with the master english strings and be able to spot missing strings without messing the file.  IDE are good to filter missing values but very bad at keeping the file organised. So, the tool would basically :

 

·        Take as input two files

o   The original base english file

o   The translated file from IDE (i’m changing the file name so that the IDE recognize them as ressource bundle)

·        It would ask me (or command-line option) for output filename. In my case that would be grouper.text.fr.fr.base.properties

·        Process :

o   Copy the base english file to the new specified name (say « newfile »)

o   Strip all vlaues from the file

o   Foreach key of the translated file, put the value into the « newfile »

·        Save « newfile »

That would end-up with a translated file, with all the keys from the english file, but the values from the translated file AND with the comments and block from the english file.

 

Hope that is clear.

Working on attestation’s translations (love that feature!)

Thanks

Francis

 

De : Hyzer, Chris []
Envoyé : 15 février 2018 10:37
À : Francis Bouchard-Boulianne ; Yoann Delattre ;
Objet : RE: french translations and _javascript_ problem

 

So you want a program where you input the grouper text file, and the translated one, and it creates a new file with the translations there, and the new properties blank so you can add the translations?  And print out which ones it needs?

 

Thanks

Chris

 

From: [] On Behalf Of Francis Bouchard-Boulianne
Sent: Thursday, February 15, 2018 10:16 AM
To: Yoann Delattre <>;
Subject: [grouper-dev] RE: french translations and _javascript_ problem

 

Ok that works, but with much more translations !! J

 

Working on them and a pull request will follow.

 

Yoann, you might want to review the pull request once it is done to ensure consistency.

 

At one point I would like to ask someone to write a script to take the english base file, strip the values and insert the french values to the keys in order to synch the attributes. If someone has such a script, please let me know. I don’t have time to work on that.

 

Francis

 

De : Yoann Delattre []
Envoyé : 15 février 2018 05:41
À : Francis Bouchard-Boulianne <>;
Objet : Re: french translations and _javascript_ problem

 

Hello Francis,

Test with the latest patch for the UI : you can create/view/edit attribut def and attribute def name in the New UI.

Yoann

 

Le 14/02/2018 à 16:01, Francis Bouchard-Boulianne a écrit :

Hi,

 

I added a lot of french translations recently. I discovered that a few of them introduced bugs in the UI.

 

Some translations use quotes ( ' ) like «  l’attribut ». This is ok most of the time, but some dialogs or toolips will make the _javascript_ code break.

 

An example is the property simpleAttributeUpdate.editPanelDeleteConfirm

« simpleAttributeUpdate.editPanelDeleteConfirm                        = Ceci supprimera la d\u00E9finition d'attribut, tous les noms de d\u00E9finition d\'attribut associ\u00E9s, et toutes les affectations et les valeurs. \u00CAtes-vous s\u00FBr de vouloir le supprimer? »

I tried to \-escape \\-escape. Only the double escape works. The generated _javascript_ is the following. If I remove the quote, it works again. This is weird though since you translate you can’t always know where this string will be used and if it is used in JS AND normal text.

 

With no escape or simple escape in the properties:

<input class="redButton" _onclick_="if (confirm('Ceci supprimera la définition *d'attribut*, tous les attributs associés, et toutes les affectations et les valeurs. Êtes-vous sûr de vouloir le supprimer?')) {ajax('../app/SimpleAttributeUpdate.attributeEditPanelDelete', {formIds: 'attributeEditFormId'}); } return false;" value="Supprimer" style="margin-top: 2px" type="submit">

 

With double escape :

<input class="redButton" _onclick_="if (confirm('Ceci supprimera la définition *d\'attribut*, tous les attributs associés, et toutes les affectations et les valeurs. Êtes-vous sûr de vouloir le supprimer?')) {ajax('../app/SimpleAttributeUpdate.attributeEditPanelDelete', {formIds: 'attributeEditFormId'}); } return false;" value="Supprimer" style="margin-top: 2px" type="submit">

 

You can test this property :

·        Go in the simple interface 

·        Attribute and permission

·        Attribute def

·        Select an attribute definition

·        Modify the attribute def

·        Try to delete it.

o   The dialog will not appear if there is a quote.

 

Is this a bug or should I log one.

___________________________________________

Francis Bouchard B. M. Sc.

Analyste – Analyse et assurance qualité - division Systèmes d’information.

Service des technologies de l’information

Université de Sherbrooke

 

Tél. : 819 821-8000, poste 63465

Courriel :

 

 



#!/usr/bin/python
import re

allTradFr = {}
notTranslate = []
# Open french file to put into a dictionary all the traductions
with open('grouper.text.fr.fr.base.properties', 'r') as fr:
for tradFr in fr.readlines():
# Regular expression to process only traductions and not the
comments
if re.match(r"([A-Z]|[a-z]).+\s?=\s?.+", tradFr):
# Split, from the first =, a line into a list, first
part contain the tag and the second part the traduction
lstTradFr = tradFr.split('=', 1)
# Add it to the dictionnary with the tag as the key
and the traduction as the value for the key
# Strip is a trim like
allTradFr[lstTradFr[0].strip()] = lstTradFr[1].strip()

# Create a new french traduction file
with open('grouper.text.fr.fr.base.properties.new', 'w') as newFr :
# Open english file and parse it
with open('grouper.text.en.us.base.properties', 'r') as en:
for tradEn in en.readlines():
# Regular expression to process only traductions and
not the comments
if re.match(r"([A-Z]|[a-z]).+\s?=\s?.+", tradEn):
# Split, from the fisrt =, a line into a
list, first part contain the tag and the second part the traduction

lstTradEn = tradEn.split('=', 1)
# Test if the tag is into the dictionnary
if allTradFr.has_key(lstTradEn[0].strip()):
# This tag is translated, we can add
it to the new file
newFr.write(lstTradEn[0].strip() + '
= ' + allTradFr.get(lstTradEn[0].strip()) + '\n')
else:
# This tag is not translated yet, so
we let the original traduction and add it to a list for reporting
notTranslate.append(tradEn)
newFr.write(tradEn)
else:
# Not a translation (certainly a comment), we add
this to the new file
newFr.write(tradEn)


# Report all the tag not translated yet

print '---------------------------------------'
print ' Tags below (' + str(len(notTranslate)) + ') are not translated yet'
print '---------------------------------------'
for tag in notTranslate:
print tag



Archive powered by MHonArc 2.6.19.

Top of Page