diff --git a/server/core/management/commands/data/instruments.csv b/server/core/management/commands/data/instruments.csv new file mode 100644 index 00000000..905d72c4 --- /dev/null +++ b/server/core/management/commands/data/instruments.csv @@ -0,0 +1,28 @@ +interkulturelle-kommunikation,intercultural-communication,communication-interculturelle +warum-sind-gesprächstechniken-wichtig,why-are-interview-techniques-important,pourquoi-les-techniques-de-communication-sont-elles-importantes +konfliktlösungsstrategien,conflict-solving-strategies,stratégies-de-résolution-de-conflit +typische-situationen-im-kaufmännischen-alltag,typical-situations-in-everday-business-life,situations-quotidiennes-typiques-pour-un-employé-de-commerce +unterschiedliche-prägung-durch-generationenbedingte-werte,Differences-due-to-generation-specific-values,Imprégnation-différente-par-les-valeurs-générationnelles +formen-der-kommunikation,forms-of-communication,formes-de-communication +inhalte-verstehen-und-erfassen,understanding-and-capturing-content,comprendre-et-saisir-les-contenus +stolpersteine-in-der-kommunikation,stumbling-blocks-in-communication,difficultes-de-la-communication +kommunikationstechniken,communication-techniques,techniques-de-communication +durchdacht-kommunizieren-und-speditiv-erledigen,well-thought-out-communication-and-efficient-handling,communication-reflechie-et-traitement-rapide +kundenbedürfnisse,customer-needs,besoins-des-clients +phasen-des-verkaufsgesprächs,phases-of-the-sales-pitch,phases-de-lentretien-de-vente +bedarfserfassung,capturing-the-need,analyse-des-besoins +verhalten-bei-beschwerden,conduct-when-complaints-are-made,comportement-en-cas-de-reclamations +nonverbale-signale-deuten,interpreting-nonverbal-signals,interpreter-les-signaux-non-verbaux +was-ist-eine-frage,what-is-a-question,quest-ce-quune-question +fragearten,types-of-question,types-de-questions +fragefunktionen,functions-of-questions,fonctions-des-questions +fragetechniken,questioning-techniques,techniques-de-questionnement +gute-fragen-und-fragefehler,good-questions-and-errors-in-questioning,bonnes-et-mauvaises-questions +antwortreaktionen,responses-to-questions,reactions-en-reponse +wertschatzung,appreciation,estime +grundannahmen-und-werte-fur-eine-wertschatzende-haltung,basic-assumptions-and-values-for-a-respectful-attitude,principes-et-valeurs-dun-comportement-respectueux +wertschatzende-kommunikation,respectful-communication,communication-respectueuse +gesprachstipps,conversation-tips,conseils-pour-lentretien +argumentieren,reasoning,argumenter +erfolgreich-uberzeugen-in-drei-schritten-merkmal-vorteil-und-nutzen,successful-persuasion-in-three-steps-feature-advantage-and-benefit,reussir-a-convaincre-a-laide-dun-plan-en-trois-points-caracteristique-avantage-benefice +unterschiede-zwischen-mundlicher-und-schriftlicher-argumentation,differences-between-verbal-and-written-reasoning,differences-entre-largumentation-orale-et-ecrite diff --git a/server/core/management/commands/data/modules.csv b/server/core/management/commands/data/modules.csv new file mode 100644 index 00000000..addd6b94 --- /dev/null +++ b/server/core/management/commands/data/modules.csv @@ -0,0 +1,6 @@ +kommunizieren-im-team,communicating-in-the-team,communiquer-au-sein-de-léquipe +zusammenarbeiten-im-team,collaborating-in-a-team,collaborer-dans-une-équipe +erstauskunft-geben,giving-preliminary-information,donner-les-informations-preliminaires +kundenbedürfnisse-erfassen,capturing-customer-needs,comprendre-les-besoins-des-clients +umgang-mit-beschwerden,handling-complaints,gestion-des-reclamations +kunst-der-gesprachsfuhrung,the-art-of-conversation,lart-de-mener-un-entretien diff --git a/server/core/management/commands/migrate_page_translation.py b/server/core/management/commands/migrate_page_translation.py index e5653757..964566ee 100644 --- a/server/core/management/commands/migrate_page_translation.py +++ b/server/core/management/commands/migrate_page_translation.py @@ -21,7 +21,9 @@ class Command(BaseCommand): parser.add_argument("--slug", type=str, required=True) parser.add_argument("--original", type=str, required=True) parser.add_argument("--language", type=str, choices=[EN, FR], default=EN) - parser.add_argument("--model", type=str, choices=["instrument", "module"], default="instrument") + parser.add_argument( + "--model", type=str, choices=["instrument", "module"], default="instrument" + ) def handle(self, *_, **options): slug = options.get("slug") @@ -37,12 +39,15 @@ class Command(BaseCommand): raise CommandError(f"Unknown model: {model}") try: - result = convert_page_to_translation(page_model, - slug=slug, original_slug=original_slug, language_code=language_code - ) + result = convert_page_to_translation( + page_model, + slug=slug, + original_slug=original_slug, + language_code=language_code, + ) self.stdout.write(result) except PageDoesNotExistException as e: - raise CommandError(f"Instrument does not exist: {e}") + raise CommandError(f"{page_model} does not exist: {e}") except AlreadyTranslatedException: raise CommandError( f"Pages {model} {slug} and {original_slug} already are translations of each other" diff --git a/server/core/management/commands/translate_from_csv.py b/server/core/management/commands/translate_from_csv.py new file mode 100644 index 00000000..e12de69b --- /dev/null +++ b/server/core/management/commands/translate_from_csv.py @@ -0,0 +1,38 @@ +import csv +from django.core import management +from django.core.management import BaseCommand + + +class Command(BaseCommand): + """ + usage: `python manage.py translate_from_csv --file file [...]` + """ + + def add_arguments(self, parser): + parser.add_argument("--file", type=str) + parser.add_argument( + "--model", type=str, choices=["instrument", "module"], default="instrument" + ) + + def handle(self, *args, **options): + filename = options["file"] + model = options["model"] + # self.stdout.write(filename) + with open(filename) as f: + reader = csv.reader(f) + for original, english, french in reader: + # self.stdout.write(f"{original}\t\t\t{english}\t\t\t{french}") + management.call_command( + "migrate_page_translation", + slug=english, + original=original, + language="en", + model=model, + ) + management.call_command( + "migrate_page_translation", + slug=french, + original=original, + language="fr", + model=model, + )