diff options
| author | Adrien Hopkins <[email protected]> | 2022-10-01 12:43:47 -0400 |
|---|---|---|
| committer | Adrien Hopkins <[email protected]> | 2022-10-01 12:43:47 -0400 |
| commit | 17e470bfc8453f2b83b2a916a936f33f6d03bae1 (patch) | |
| tree | 774760a5c94aaf6db99ba84468d4b6b575aee9d4 /src | |
| parent | f26acd63741a23b251ad991b78657409d4dc9550 (diff) | |
| download | coinos-ui-17e470bfc8453f2b83b2a916a936f33f6d03bae1.tar.gz coinos-ui-17e470bfc8453f2b83b2a916a936f33f6d03bae1.zip | |
Guided Translation Script can detect removed strings
Diffstat (limited to 'src')
| -rw-r--r-- | src/locales/fr.json | 14 | ||||
| -rw-r--r-- | src/locales/guided_translation.py | 40 |
2 files changed, 28 insertions, 26 deletions
diff --git a/src/locales/fr.json b/src/locales/fr.json index e12fe7d2..2cbf756c 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -8,20 +8,6 @@ "p1": "<strong>coinos</strong> est un portefeuille, point de vente, marché d'e-commerce et plateforme d'échange de bitcoin <strong>open source</strong>. Development a commencé en Vancouver le septembre de 2012 pour donner aux marchands du coin un façon pratique d'accepter des paiements en bitcoin.", "p2": "Il a eu plus de fonctions au fil des ans pour satisfaire une grande variété de cas d'utilisation avec le but de rendre commencer utiliser bitcoin rapidement, à bas prix, et en sécurité aussi façile que possible pour n'importe qui.", "p3": "Tout le monde peux télécharger le code source et héberger leur propre instance de la plateforme soutenu par leur propres nœuds de bitcoin, liquid ou lightning, ou contactez-nous et nous l'installalons pour vous avec plaisir.", - "p4": "Transferts entre comptes de garde d'utilisateurs différents en notre serveur sont complètement gratuits, instants et sans limites.", - "founder": { - "header": "Le Fondateur", - "name": "Adam Soltys", - "position": "Officier Technique Principal", - "qualifications": { - "bitcoin": "Utilisant bitcoin depuis 2011", - "webDev": "20+ ans d'experience de programmation web en gouvernement et industrie", - "bitcoinVancouver": "Organisateur précoce de la rencontre bitcoin Vancouver", - "bitcoinCoop": "Fondateur de The bitcoin Co-op et défenseur précoce de Decentral Vancouver", - "beliefs": "Yogi, permaculturiste, anarchiste, décentraliste", - "familialRelationships": "Mari, père, frère, fils" - } - }, "locations": { "header": "Établissements", "description": "Il y a des entreprises qui acceptent bitcoin utilisant le point de vente coinos. Si vous utilisez notre appli, s'il vous plait <a href=\"mailto:[email protected]\" class=\"underline underline-offset-4\">fais-le-nous savoir!</a>" diff --git a/src/locales/guided_translation.py b/src/locales/guided_translation.py index 2cc4d2ce..870cdf0b 100644 --- a/src/locales/guided_translation.py +++ b/src/locales/guided_translation.py @@ -110,20 +110,36 @@ if __name__ == "__main__": len(to_id_list), to_locale) logging.debug("List of strings: %s", to_id_list) - if set(from_id_list) == set(to_id_list): - print("Translations are already complete.") - else: + # offer to remove strings in to list that were removed from from list + removed_strings = [] + for string_id in to_id_list: + if string_id not in from_id_list: + removed_strings.append(string_id) + + if removed_strings: + print("""There are %d pieces of text that are in the translated locale (%s) but not the original locale (%s). +The IDs of these pieces of text are: %s +This could mean that this text was translated first, or it could mean this text was removed from the original locale but has yet to be removed from the translated locale. In the latter case, you may want to remove them from the translated locale file. +""" % (len(removed_strings), to_locale, from_locale, removed_strings), file=sys.stderr) + + untranslated_strings = [] + for string_id in from_id_list: + if string_id not in to_id_list: + untranslated_strings.append(string_id) + + if untranslated_strings: # localize strings! try: - for string_id in from_id_list: - if string_id not in to_id_list: - localize_string(string_id, from_data, to_data) - to_id_list.append(string_id) + for string_id in untranslated_strings: + localize_string(string_id, from_data, to_data) + to_id_list.append(string_id) except KeyboardInterrupt: print("\nProgram interrupted. Saving strings...") + else: + print("Translations already completed.") - # save localized data - with open(to_locale + ".json", 'w', encoding='utf-8') as to_file: - json.dump(to_data, to_file, ensure_ascii=False, indent='\t') - to_file.write('\n') - logging.info("Saved %d localized strings to %s.json", len(to_id_list), to_locale) + # save localized data + with open(to_locale + ".json", 'w', encoding='utf-8') as to_file: + json.dump(to_data, to_file, ensure_ascii=False, indent='\t') + to_file.write('\n') + logging.info("Saved %d localized strings to %s.json", len(to_id_list), to_locale) |
