# -*- coding: utf-8 -*- """Oberflaechentexte in Deutsch, Englisch und Franzoesisch. Die Sprache richtet sich nach der Oberflaechensprache von LibreOffice (/org.openoffice.Setup/L10N/ooLocale). Ist sie nicht hinterlegt, wird Englisch verwendet. """ import os import uno FALLBACK = "en" TEXTS = { "en": { # -- Dialog: Synopse aus der Aenderungsverfolgung ----------------- "dlg.title": "Create synopsis", "dlg.people": "Contributors (%d): %s", "dlg.people.none": "none found", "dlg.group.mode": "Display of changes", "dlg.mode.cumulative": "Cumulative \u2013 one column with the final version", "dlg.mode.stacked": "Stacked \u2013 one column, contributors below each other", "dlg.mode.separate": "Separate \u2013 one column per contributor (%d)", "dlg.mode.hint": "With more than three contributors the separate " "display quickly becomes too narrow.", "dlg.group.content": "Content", "dlg.opt.deletions": "Keep deleted text, struck through", "dlg.opt.elide": "Shorten unchanged passages to the context", "dlg.opt.final": "Also show the final version (stacked/separate)", "dlg.opt.notes": "Include comments and annotations", "dlg.opt.quote": "quoting the commented passage", "dlg.opt.onlychanged": "Only changed or commented paragraphs", "dlg.group.target": "Target document", "dlg.opt.numbering": "Sequential number", "dlg.opt.landscape": "Landscape", "dlg.ok": "OK", "dlg.cancel": "Cancel", # -- Dialog: Dokumentvergleich ------------------------------------ "cmp.title": "Compare two documents", "cmp.group.docs": "Documents", "cmp.source": "Source version (left column):", "cmp.target": "Final version (middle column):", "cmp.group.comments": "Comments in the final version", "cmp.comments.column": "In a separate column on the right", "cmp.comments.inline": "Below the passage in the middle column", "cmp.comments.none": "Do not include", "cmp.comments.hint": "If the final version contains no comments, " "the third column is omitted automatically.", "cmp.group.display": "Display", "cmp.opt.highlight": "Highlight differences word by word", "cmp.opt.quote": "Quote the commented passage", "cmp.opt.onlychanged": "Only include differing paragraphs", # -- Tabelle ------------------------------------------------------- "col.number": "No.", "col.original": "Original version", "col.final": "Final version", "col.changes": "Changes", "col.comments": "Comments", "doc.title": "Synopsis", "doc.title.named": "Synopsis: %s", "doc.title.compare": "Synopsis: %s \u2192 %s", "text.removed": "deleted without replacement", "text.noteonly": " \u2013 comment only", "text.resolved": " (resolved)", "text.unknown": "(unknown)", # -- Meldungen ----------------------------------------------------- "msg.nodoc": "Please bring a Writer document to the front first.", "msg.nochanges": "The document contains neither tracked changes " "nor comments.", "msg.noparagraphs": "No changed paragraphs were found.", "msg.twodocs": "At least two Writer documents must be open " "for a comparison.", "msg.different": "Please select two different documents.", "msg.identical": "The two documents are identical in content.", "msg.error.build": "Error while creating the synopsis:\n\n%s\n\n%s", "msg.error.compare": "Error during comparison:\n\n%s\n\n%s", }, "de": { "dlg.title": "Synopse erzeugen", "dlg.people": "Beteiligte (%d): %s", "dlg.people.none": "keine gefunden", "dlg.group.mode": "Darstellung der \u00c4nderungen", "dlg.mode.cumulative": "Kumuliert \u2013 eine Spalte mit der Endfassung", "dlg.mode.stacked": "Gestapelt \u2013 eine Spalte, Personen untereinander", "dlg.mode.separate": "Getrennt \u2013 je Person eine eigene Spalte (%d)", "dlg.mode.hint": "Bei mehr als drei Beteiligten wird die getrennte " "Darstellung schnell zu schmal.", "dlg.group.content": "Inhalt", "dlg.opt.deletions": "Gel\u00f6schten Text durchgestrichen mitf\u00fchren", "dlg.opt.elide": "Unver\u00e4nderte Passagen auf den Kontext k\u00fcrzen", "dlg.opt.final": "Endfassung zus\u00e4tzlich ausweisen (gestapelt/getrennt)", "dlg.opt.notes": "Anmerkungen und Kommentare \u00fcbernehmen", "dlg.opt.quote": "dabei kommentierte Textstelle zitieren", "dlg.opt.onlychanged": "Nur ge\u00e4nderte oder kommentierte Abs\u00e4tze", "dlg.group.target": "Zieldokument", "dlg.opt.numbering": "Laufende Nummer", "dlg.opt.landscape": "Querformat", "dlg.ok": "OK", "dlg.cancel": "Abbrechen", "cmp.title": "Zwei Dokumente vergleichen", "cmp.group.docs": "Dokumente", "cmp.source": "Quellfassung (linke Spalte):", "cmp.target": "Endfassung (mittlere Spalte):", "cmp.group.comments": "Kommentare der Endfassung", "cmp.comments.column": "In einer eigenen Spalte rechts", "cmp.comments.inline": "Unter der Textstelle in der mittleren Spalte", "cmp.comments.none": "Nicht \u00fcbernehmen", "cmp.comments.hint": "Enth\u00e4lt die Endfassung keine Kommentare, " "entf\u00e4llt die dritte Spalte automatisch.", "cmp.group.display": "Darstellung", "cmp.opt.highlight": "Unterschiede wortweise hervorheben", "cmp.opt.quote": "Kommentierte Textstelle zitieren", "cmp.opt.onlychanged": "Nur abweichende Abs\u00e4tze aufnehmen", "col.number": "Nr.", "col.original": "Ursprungsfassung", "col.final": "Endfassung", "col.changes": "\u00c4nderungen", "col.comments": "Kommentare", "doc.title": "Synopse", "doc.title.named": "Synopse: %s", "doc.title.compare": "Synopse: %s \u2192 %s", "text.removed": "ersatzlos gestrichen", "text.noteonly": " \u2013 nur Anmerkung", "text.resolved": " (erledigt)", "text.unknown": "(unbekannt)", "msg.nodoc": "Bitte zuerst ein Writer-Dokument in den Vordergrund holen.", "msg.nochanges": "Das Dokument enth\u00e4lt weder nachverfolgte " "\u00c4nderungen noch Anmerkungen.", "msg.noparagraphs": "Es wurden keine ge\u00e4nderten Abs\u00e4tze gefunden.", "msg.twodocs": "F\u00fcr den Vergleich m\u00fcssen mindestens zwei " "Writer-Dokumente ge\u00f6ffnet sein.", "msg.different": "Bitte zwei verschiedene Dokumente ausw\u00e4hlen.", "msg.identical": "Die beiden Dokumente sind inhaltlich identisch.", "msg.error.build": "Fehler beim Erzeugen der Synopse:\n\n%s\n\n%s", "msg.error.compare": "Fehler beim Vergleich:\n\n%s\n\n%s", }, "fr": { "dlg.title": "Cr\u00e9er une synopse", "dlg.people": "Participants (%d) : %s", "dlg.people.none": "aucun trouv\u00e9", "dlg.group.mode": "Pr\u00e9sentation des modifications", "dlg.mode.cumulative": "Cumul\u00e9e \u2013 une colonne avec la version finale", "dlg.mode.stacked": "Empil\u00e9e \u2013 une colonne, participants l\u2019un sous l\u2019autre", "dlg.mode.separate": "S\u00e9par\u00e9e \u2013 une colonne par participant (%d)", "dlg.mode.hint": "Au-del\u00e0 de trois participants, la pr\u00e9sentation " "s\u00e9par\u00e9e devient vite trop \u00e9troite.", "dlg.group.content": "Contenu", "dlg.opt.deletions": "Conserver le texte supprim\u00e9, barr\u00e9", "dlg.opt.elide": "R\u00e9duire les passages inchang\u00e9s au contexte", "dlg.opt.final": "Afficher aussi la version finale (empil\u00e9e/s\u00e9par\u00e9e)", "dlg.opt.notes": "Reprendre les commentaires et annotations", "dlg.opt.quote": "en citant le passage comment\u00e9", "dlg.opt.onlychanged": "Uniquement les paragraphes modifi\u00e9s ou comment\u00e9s", "dlg.group.target": "Document cible", "dlg.opt.numbering": "Num\u00e9rotation", "dlg.opt.landscape": "Paysage", "dlg.ok": "OK", "dlg.cancel": "Annuler", "cmp.title": "Comparer deux documents", "cmp.group.docs": "Documents", "cmp.source": "Version source (colonne de gauche) :", "cmp.target": "Version finale (colonne du milieu) :", "cmp.group.comments": "Commentaires de la version finale", "cmp.comments.column": "Dans une colonne distincte \u00e0 droite", "cmp.comments.inline": "Sous le passage dans la colonne du milieu", "cmp.comments.none": "Ne pas reprendre", "cmp.comments.hint": "Si la version finale ne contient aucun " "commentaire, la troisi\u00e8me colonne est " "supprim\u00e9e automatiquement.", "cmp.group.display": "Pr\u00e9sentation", "cmp.opt.highlight": "Mettre en \u00e9vidence les diff\u00e9rences mot \u00e0 mot", "cmp.opt.quote": "Citer le passage comment\u00e9", "cmp.opt.onlychanged": "N\u2019inclure que les paragraphes divergents", "col.number": "N\u00b0", "col.original": "Version initiale", "col.final": "Version finale", "col.changes": "Modifications", "col.comments": "Commentaires", "doc.title": "Synopse", "doc.title.named": "Synopse : %s", "doc.title.compare": "Synopse : %s \u2192 %s", "text.removed": "supprim\u00e9 sans remplacement", "text.noteonly": " \u2013 commentaire seulement", "text.resolved": " (r\u00e9solu)", "text.unknown": "(inconnu)", "msg.nodoc": "Veuillez d\u2019abord placer un document Writer au " "premier plan.", "msg.nochanges": "Le document ne contient ni modifications suivies " "ni commentaires.", "msg.noparagraphs": "Aucun paragraphe modifi\u00e9 n\u2019a \u00e9t\u00e9 trouv\u00e9.", "msg.twodocs": "Au moins deux documents Writer doivent \u00eatre " "ouverts pour une comparaison.", "msg.different": "Veuillez s\u00e9lectionner deux documents diff\u00e9rents.", "msg.identical": "Les deux documents ont un contenu identique.", "msg.error.build": "Erreur lors de la cr\u00e9ation de la synopse :" "\n\n%s\n\n%s", "msg.error.compare": "Erreur lors de la comparaison :\n\n%s\n\n%s", }, } _language = FALLBACK def _office_locale(ctx): """Oberflaechensprache von LibreOffice, z. B. 'de-DE'.""" try: provider = ctx.ServiceManager.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", ctx) argument = uno.createUnoStruct("com.sun.star.beans.PropertyValue") argument.Name = "nodepath" argument.Value = "/org.openoffice.Setup/L10N" node = provider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", (argument,)) return node.getByName("ooLocale") or "" except Exception: return "" def set_language(ctx=None): """Sprache bestimmen. Ist sie nicht hinterlegt, bleibt es bei Englisch.""" global _language tag = _office_locale(ctx) if ctx is not None else "" if not tag: tag = os.environ.get("LANGUAGE") or os.environ.get("LANG") or "" primary = tag.replace("_", "-").split("-")[0].split(".")[0].lower() _language = primary if primary in TEXTS else FALLBACK return _language def language(): return _language def t(key, *args): """Uebersetzten Text liefern; fehlt er, greift Englisch.""" value = TEXTS.get(_language, {}).get(key) if value is None: value = TEXTS[FALLBACK].get(key, key) if args: try: value = value % args except Exception: pass return value