mistercrunch commented on issue #27959:
URL: https://github.com/apache/superset/issues/27959#issuecomment-2062754473

   I'm trying to diff to see what changed ->
   
   ```
   git diff cc2f6f1ed9 cc2f6f1ed9^ 
superset/translations/fr/LC_MESSAGES/messages.po
   ```
   
   but the git differ isn't anchoring in the right places to show the 
differences properly, so it's hard to assess whether the edits are all bad or 
only a subset
   
   leaving a trace here:
   ```
   # checkout the after file
   git checkout cc2f6f1ed9 && cp 
superset/translations/fr/LC_MESSAGES/messages.json /tmp/after.json
   # checkout the before file
   git checkout cc2f6f1ed9^ && cp 
superset/translations/fr/LC_MESSAGES/messages.json /tmp/before.json
   ```
   compare the before/after
   ```python
   import json
   
   # Load JSON data from files
   def load_json(filename):
       with open(filename, 'r', encoding='utf-8') as file:
           return json.load(file)
   
   # Compare the translations in two JSON objects
   def compare_translations(data1, data2):
       results = []
       for key in data1["locale_data"]["superset"]:
           if key and key in data2["locale_data"]["superset"]:
               translation1 = data1["locale_data"]["superset"][key][0]
               translation2 = data2["locale_data"]["superset"][key][0]
               if translation1 != translation2:
                   results.append({
                       "english_source_sentence": key,
                       "french_from_file1": translation1,
                       "french_from_file2": translation2
                   })
       return results
   
   # Main function to run the comparison
   def main():
       file1_data = load_json('before.json')
       file2_data = load_json('after.json')
       differences = compare_translations(file1_data, file2_data)
       print(json.dumps(differences, ensure_ascii=False, indent=2))
   
   if __name__ == "__main__":
       main()
   ```
   sample of the output:
   ```json
     {
       "english_source_sentence": "You are importing one or more saved queries 
that already exist. Overwriting might cause you to lose some of your work. Are y
   ou sure you want to overwrite?",
       "french_from_file1": "Vous importez une ou plusieurs requêtes 
sauvegardées qui existent déjà. L'écrasement peut vous conduire à perdre une 
partie de vot
   re travail. Etes-vous sûr de vouloir ce remplacement ?",
       "french_from_file2": "Vous importez une ou plusieurs requêtes 
enregistrées qui existent déjà. L'écrasement pourrait vous faire perdre une 
partie de votr
   e travail. Êtes-vous sûr de vouloir les écraser?"
     },
     {
       "english_source_sentence": "Link Copied!",
       "french_from_file1": "Lien copié !",
       "french_from_file2": "Lien copié!"
     },
     {
       "english_source_sentence": "There was an issue deleting the selected 
queries: %s",
       "french_from_file1": "Il y a eu un problème lors de la suppression de 
requêtes sélectionnées : %s",
       "french_from_file2": "Il y a eu un problème lors de la suppression des 
requêtes sélectionnées : %s"
     },
     {
       "english_source_sentence": "Delete query",
       "french_from_file1": "Effacer la requête",
       "french_from_file2": "Supprimer la requête"
     },
     {
       "english_source_sentence": "Are you sure you want to delete the selected 
queries?",
       "french_from_file1": "Ete-vous sûr de vouloir supprimer les requêtes 
sélectionnées ?",
       "french_from_file2": "Voulez-vous vraiment supprimer les requêtes 
sélectionnées?"
     },
   ```
   Overall seemed good to me. I'd hate to revert the whole thing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to