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 12:13:42 +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=1524564826; 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=34VbHVgC081dwyPrfc+fsxdSw/6vXsL03dRD/7IEkk0=; b=PQ7LqToiUKN/2dPZHMZk99lWVitrV0hALVJsiemIEjGAi9Y3i6wFFPLEwZM1D9+moeuC9x qahb8h4MBNKUcIfooBXbXHhil3ErbNYNYYjWIyx6e2akt/71RV9ALDopVo4yvHIVlMmW51 X2nKMAKChaDrnwBHj3WOM/s9H7uPP3U=
  • Arc-seal: i=1; s=aclille-dkim; d=ac-lille.fr; t=1524564826; a=rsa-sha256; cv=none; b=E1/ungWDpUkQAZE+f73egpQF6La7QQmLWSIB7nwNSTAYHqSfugV76mZSYyx8iOl+5US6RtecNxzTgebCZCQWey7T+zwOmGIH9sRnQOjXQuWrTePNfxb4OzuI4B4mBKXe/HOedMa+bh4XHTH8DnSi2+TdMzBtlXNROgWKrbmevd4=
  • Authentication-results: auth=pass
  • Ironport-phdr: 9a23:hKHSrB2d39SUVorfsmDT+DRfVm0co7zxezQtwd8ZsesWK/zxwZ3uMQTl6Ol3ixeRBMOHs6kC07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffwtFiCChbb9uMR67sRjfus4K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SgHTwrSN8tmZkDb1srSPu4iRWW7i2jBbldu7GPDYAo6K+Ui2n2LsB7jXrL0KA9k0MrasJEcGmngqpysQbJUd2a236FnrqnIPxPlBXG832OmC/X5BlV

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 a line into a list, first part contain the
tag and the second part the traduction
lstTradFr = tradFr.split('=')
# 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 a line into a list, first part
contain the tag and the second part the traduction
lstTradEn = tradEn.split('=')
# 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