add more translation

This commit is contained in:
jonaswinkler 2020-12-30 21:48:34 +01:00
parent 8d665aeac4
commit 750d08ec01
3 changed files with 748 additions and 72 deletions

View File

@ -13,6 +13,8 @@ from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from documents.file_handling import archive_name_from_filename
from documents.parsers import get_default_file_extension
@ -27,36 +29,31 @@ class MatchingModel(models.Model):
MATCH_AUTO = 6
MATCHING_ALGORITHMS = (
(MATCH_ANY, "Any"),
(MATCH_ALL, "All"),
(MATCH_LITERAL, "Literal"),
(MATCH_REGEX, "Regular Expression"),
(MATCH_FUZZY, "Fuzzy Match"),
(MATCH_AUTO, "Automatic Classification"),
(MATCH_ANY, _("Any")),
(MATCH_ALL, _("All")),
(MATCH_LITERAL, _("Literal")),
(MATCH_REGEX, _("Regular Expression")),
(MATCH_FUZZY, _("Fuzzy Match")),
(MATCH_AUTO, _("Automatic Classification")),
)
name = models.CharField(max_length=128, unique=True)
name = models.CharField(
_("name"),
max_length=128, unique=True)
match = models.CharField(
_("match"),
max_length=256, blank=True)
match = models.CharField(max_length=256, blank=True)
matching_algorithm = models.PositiveIntegerField(
_("matching algorithm"),
choices=MATCHING_ALGORITHMS,
default=MATCH_ANY,
help_text=(
"Which algorithm you want to use when matching text to the OCR'd "
"PDF. Here, \"any\" looks for any occurrence of any word "
"provided in the PDF, while \"all\" requires that every word "
"provided appear in the PDF, albeit not in the order provided. A "
"\"literal\" match means that the text you enter must appear in "
"the PDF exactly as you've entered it, and \"regular expression\" "
"uses a regex to match the PDF. (If you don't know what a regex "
"is, you probably don't want this option.) Finally, a \"fuzzy "
"match\" looks for words or phrases that are mostly—but not "
"exactly—the same, which can be useful for matching against "
"documents containg imperfections that foil accurate OCR."
)
default=MATCH_ANY
)
is_insensitive = models.BooleanField(default=True)
is_insensitive = models.BooleanField(
_("is insensitive"),
default=True)
class Meta:
abstract = True
@ -80,6 +77,8 @@ class Correspondent(MatchingModel):
class Meta:
ordering = ("name",)
verbose_name = _("correspondent")
verbose_name_plural = _("correspondents")
class Tag(MatchingModel):
@ -100,18 +99,28 @@ class Tag(MatchingModel):
(13, "#cccccc")
)
colour = models.PositiveIntegerField(choices=COLOURS, default=1)
colour = models.PositiveIntegerField(
_("color"),
choices=COLOURS, default=1)
is_inbox_tag = models.BooleanField(
_("is inbox tag"),
default=False,
help_text="Marks this tag as an inbox tag: All newly consumed "
"documents will be tagged with inbox tags."
help_text=_("Marks this tag as an inbox tag: All newly consumed "
"documents will be tagged with inbox tags.")
)
class Meta:
verbose_name = _("tag")
verbose_name_plural = _("tags")
class DocumentType(MatchingModel):
pass
class Meta:
verbose_name = _("document type")
verbose_name_plural = _("document types")
class Document(models.Model):
@ -119,8 +128,8 @@ class Document(models.Model):
STORAGE_TYPE_UNENCRYPTED = "unencrypted"
STORAGE_TYPE_GPG = "gpg"
STORAGE_TYPES = (
(STORAGE_TYPE_UNENCRYPTED, "Unencrypted"),
(STORAGE_TYPE_GPG, "Encrypted with GNU Privacy Guard")
(STORAGE_TYPE_UNENCRYPTED, _("Unencrypted")),
(STORAGE_TYPE_GPG, _("Encrypted with GNU Privacy Guard"))
)
correspondent = models.ForeignKey(
@ -128,55 +137,68 @@ class Document(models.Model):
blank=True,
null=True,
related_name="documents",
on_delete=models.SET_NULL
on_delete=models.SET_NULL,
verbose_name=_("correspondent")
)
title = models.CharField(max_length=128, blank=True, db_index=True)
title = models.CharField(
_("title"),
max_length=128, blank=True, db_index=True)
document_type = models.ForeignKey(
DocumentType,
blank=True,
null=True,
related_name="documents",
on_delete=models.SET_NULL
on_delete=models.SET_NULL,
verbose_name=_("document type")
)
content = models.TextField(
_("content"),
blank=True,
help_text="The raw, text-only data of the document. This field is "
"primarily used for searching."
help_text=_("The raw, text-only data of the document. This field is "
"primarily used for searching.")
)
mime_type = models.CharField(
_("mime type"),
max_length=256,
editable=False
)
tags = models.ManyToManyField(
Tag, related_name="documents", blank=True)
Tag, related_name="documents", blank=True,
verbose_name=_("tags")
)
checksum = models.CharField(
_("checksum"),
max_length=32,
editable=False,
unique=True,
help_text="The checksum of the original document."
help_text=_("The checksum of the original document.")
)
archive_checksum = models.CharField(
_("archive checksum"),
max_length=32,
editable=False,
blank=True,
null=True,
help_text="The checksum of the archived document."
help_text=_("The checksum of the archived document.")
)
created = models.DateTimeField(
_("created"),
default=timezone.now, db_index=True)
modified = models.DateTimeField(
_("modified"),
auto_now=True, editable=False, db_index=True)
storage_type = models.CharField(
_("storage type"),
max_length=11,
choices=STORAGE_TYPES,
default=STORAGE_TYPE_UNENCRYPTED,
@ -184,27 +206,32 @@ class Document(models.Model):
)
added = models.DateTimeField(
_("added"),
default=timezone.now, editable=False, db_index=True)
filename = models.FilePathField(
_("filename"),
max_length=1024,
editable=False,
default=None,
null=True,
help_text="Current filename in storage"
help_text=_("Current filename in storage")
)
archive_serial_number = models.IntegerField(
_("archive serial number"),
blank=True,
null=True,
unique=True,
db_index=True,
help_text="The position of this document in your physical document "
"archive."
help_text=_("The position of this document in your physical document "
"archive.")
)
class Meta:
ordering = ("-created",)
verbose_name = _("Document")
verbose_name_plural = _("Documents")
def __str__(self):
created = datetime.date.isoformat(self.created)
@ -293,13 +320,22 @@ class Log(models.Model):
(logging.CRITICAL, "Critical"),
)
group = models.UUIDField(blank=True, null=True)
message = models.TextField()
level = models.PositiveIntegerField(choices=LEVELS, default=logging.INFO)
created = models.DateTimeField(auto_now_add=True)
group = models.UUIDField(
_("group"),
blank=True, null=True)
message = models.TextField(_("message"))
level = models.PositiveIntegerField(
_("level"),
choices=LEVELS, default=logging.INFO)
created = models.DateTimeField(_("created"), auto_now_add=True)
class Meta:
ordering = ("-created",)
verbose_name = _("log")
verbose_name_plural = _("logs")
def __str__(self):
return self.message
@ -310,48 +346,70 @@ class SavedView(models.Model):
class Meta:
ordering = ("name",)
verbose_name = _("saved view")
verbose_name_plural = _("saved views")
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=128)
user = models.ForeignKey(User, on_delete=models.CASCADE,
verbose_name=_("user"))
name = models.CharField(
_("name"),
max_length=128)
show_on_dashboard = models.BooleanField()
show_in_sidebar = models.BooleanField()
show_on_dashboard = models.BooleanField(
_("show on dashboard"),
)
show_in_sidebar = models.BooleanField(
_("show in sidebar"),
)
sort_field = models.CharField(max_length=128)
sort_reverse = models.BooleanField(default=False)
sort_field = models.CharField(
_("sort field"),
max_length=128)
sort_reverse = models.BooleanField(
_("sort reverse"),
default=False)
class SavedViewFilterRule(models.Model):
RULE_TYPES = [
(0, "Title contains"),
(1, "Content contains"),
(2, "ASN is"),
(3, "Correspondent is"),
(4, "Document type is"),
(5, "Is in inbox"),
(6, "Has tag"),
(7, "Has any tag"),
(8, "Created before"),
(9, "Created after"),
(10, "Created year is"),
(11, "Created month is"),
(12, "Created day is"),
(13, "Added before"),
(14, "Added after"),
(15, "Modified before"),
(16, "Modified after"),
(17, "Does not have tag"),
(0, _("title contains")),
(1, _("content contains")),
(2, _("ASN is")),
(3, _("correspondent is")),
(4, _("document type is")),
(5, _("is in inbox")),
(6, _("has tag")),
(7, _("has any tag")),
(8, _("created before")),
(9, _("created after")),
(10, _("created year is")),
(11, _("created month is")),
(12, _("created day is")),
(13, _("added before")),
(14, _("added after")),
(15, _("modified before")),
(16, _("modified after")),
(17, _("does not have tag")),
]
saved_view = models.ForeignKey(
SavedView,
on_delete=models.CASCADE,
related_name="filter_rules"
related_name="filter_rules",
verbose_name=_("saved view")
)
rule_type = models.PositiveIntegerField(choices=RULE_TYPES)
rule_type = models.PositiveIntegerField(
_("rule type"),
choices=RULE_TYPES)
value = models.CharField(max_length=128)
value = models.CharField(
_("value"),
max_length=128)
class Meta:
verbose_name = _("filter rule")
verbose_name_plural = _("filter rules")
# TODO: why is this in the models file?

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-30 00:37+0000\n"
"POT-Creation-Date: 2020-12-30 19:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,6 +18,302 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: documents/models.py:32
msgid "Any"
msgstr ""
#: documents/models.py:33
msgid "All"
msgstr ""
#: documents/models.py:34
msgid "Literal"
msgstr ""
#: documents/models.py:35
msgid "Regular Expression"
msgstr ""
#: documents/models.py:36
msgid "Fuzzy Match"
msgstr ""
#: documents/models.py:37
msgid "Automatic Classification"
msgstr ""
#: documents/models.py:41 documents/models.py:355
msgid "name"
msgstr ""
#: documents/models.py:45
msgid "match"
msgstr ""
#: documents/models.py:49
msgid "matching algorithm"
msgstr ""
#: documents/models.py:55
msgid "is insensitive"
msgstr ""
#: documents/models.py:80 documents/models.py:141
msgid "correspondent"
msgstr ""
#: documents/models.py:81
msgid "correspondents"
msgstr ""
#: documents/models.py:103
msgid "color"
msgstr ""
#: documents/models.py:107
msgid "is inbox tag"
msgstr ""
#: documents/models.py:109
msgid ""
"Marks this tag as an inbox tag: All newly consumed documents will be tagged "
"with inbox tags."
msgstr ""
#: documents/models.py:114
msgid "tag"
msgstr ""
#: documents/models.py:115 documents/models.py:172
msgid "tags"
msgstr ""
#: documents/models.py:121 documents/models.py:154
msgid "document type"
msgstr "Dokumenttyp"
#: documents/models.py:122
msgid "document types"
msgstr "Dokumenttypen"
#: documents/models.py:131
msgid "Unencrypted"
msgstr ""
#: documents/models.py:132
msgid "Encrypted with GNU Privacy Guard"
msgstr ""
#: documents/models.py:145
msgid "title"
msgstr ""
#: documents/models.py:158
msgid "content"
msgstr ""
#: documents/models.py:160
msgid ""
"The raw, text-only data of the document. This field is primarily used for "
"searching."
msgstr ""
#: documents/models.py:165
msgid "mime type"
msgstr ""
#: documents/models.py:176
msgid "checksum"
msgstr ""
#: documents/models.py:180
msgid "The checksum of the original document."
msgstr ""
#: documents/models.py:184
msgid "archive checksum"
msgstr ""
#: documents/models.py:189
msgid "The checksum of the archived document."
msgstr ""
#: documents/models.py:193 documents/models.py:333
msgid "created"
msgstr ""
#: documents/models.py:197
msgid "modified"
msgstr ""
#: documents/models.py:201
msgid "storage type"
msgstr ""
#: documents/models.py:209
msgid "added"
msgstr ""
#: documents/models.py:213
msgid "filename"
msgstr ""
#: documents/models.py:218
msgid "Current filename in storage"
msgstr ""
#: documents/models.py:222
msgid "archive serial number"
msgstr ""
#: documents/models.py:227
msgid "The position of this document in your physical document archive."
msgstr ""
#: documents/models.py:233
msgid "Document"
msgstr ""
#: documents/models.py:234
msgid "Documents"
msgstr ""
#: documents/models.py:324
msgid "group"
msgstr ""
#: documents/models.py:327
msgid "message"
msgstr ""
#: documents/models.py:330
msgid "level"
msgstr ""
#: documents/models.py:337
msgid "log"
msgstr ""
#: documents/models.py:338
msgid "logs"
msgstr ""
#: documents/models.py:349 documents/models.py:399
msgid "saved view"
msgstr ""
#: documents/models.py:350
msgid "saved views"
msgstr ""
#: documents/models.py:353
msgid "user"
msgstr "Benutzer"
#: documents/models.py:359
msgid "show on dashboard"
msgstr ""
#: documents/models.py:362
msgid "show in sidebar"
msgstr ""
#: documents/models.py:366
msgid "sort field"
msgstr ""
#: documents/models.py:369
msgid "sort reverse"
msgstr ""
#: documents/models.py:375
msgid "title contains"
msgstr ""
#: documents/models.py:376
msgid "content contains"
msgstr ""
#: documents/models.py:377
msgid "ASN is"
msgstr ""
#: documents/models.py:378
msgid "correspondent is"
msgstr ""
#: documents/models.py:379
msgid "document type is"
msgstr ""
#: documents/models.py:380
msgid "is in inbox"
msgstr ""
#: documents/models.py:381
msgid "has tag"
msgstr ""
#: documents/models.py:382
msgid "has any tag"
msgstr ""
#: documents/models.py:383
msgid "created before"
msgstr ""
#: documents/models.py:384
msgid "created after"
msgstr ""
#: documents/models.py:385
msgid "created year is"
msgstr ""
#: documents/models.py:386
msgid "created month is"
msgstr ""
#: documents/models.py:387
msgid "created day is"
msgstr ""
#: documents/models.py:388
msgid "added before"
msgstr ""
#: documents/models.py:389
msgid "added after"
msgstr ""
#: documents/models.py:390
msgid "modified before"
msgstr ""
#: documents/models.py:391
msgid "modified after"
msgstr ""
#: documents/models.py:392
msgid "does not have tag"
msgstr ""
#: documents/models.py:403
msgid "rule type"
msgstr ""
#: documents/models.py:407
msgid "value"
msgstr ""
#: documents/models.py:411
msgid "filter rule"
msgstr ""
#: documents/models.py:412
msgid "filter rules"
msgstr "Filterregeln"
#: paperless/settings.py:253
msgid "English"
msgstr ""

View File

@ -0,0 +1,322 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-30 19:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: documents/models.py:32
msgid "Any"
msgstr ""
#: documents/models.py:33
msgid "All"
msgstr ""
#: documents/models.py:34
msgid "Literal"
msgstr ""
#: documents/models.py:35
msgid "Regular Expression"
msgstr ""
#: documents/models.py:36
msgid "Fuzzy Match"
msgstr ""
#: documents/models.py:37
msgid "Automatic Classification"
msgstr ""
#: documents/models.py:41 documents/models.py:355
msgid "name"
msgstr ""
#: documents/models.py:45
msgid "match"
msgstr ""
#: documents/models.py:49
msgid "matching algorithm"
msgstr ""
#: documents/models.py:55
msgid "is insensitive"
msgstr ""
#: documents/models.py:80 documents/models.py:141
msgid "correspondent"
msgstr ""
#: documents/models.py:81
msgid "correspondents"
msgstr ""
#: documents/models.py:103
msgid "color"
msgstr ""
#: documents/models.py:107
msgid "is inbox tag"
msgstr ""
#: documents/models.py:109
msgid ""
"Marks this tag as an inbox tag: All newly consumed documents will be tagged "
"with inbox tags."
msgstr ""
#: documents/models.py:114
msgid "tag"
msgstr ""
#: documents/models.py:115 documents/models.py:172
msgid "tags"
msgstr ""
#: documents/models.py:121 documents/models.py:154
msgid "document type"
msgstr ""
#: documents/models.py:122
msgid "document types"
msgstr ""
#: documents/models.py:131
msgid "Unencrypted"
msgstr ""
#: documents/models.py:132
msgid "Encrypted with GNU Privacy Guard"
msgstr ""
#: documents/models.py:145
msgid "title"
msgstr ""
#: documents/models.py:158
msgid "content"
msgstr ""
#: documents/models.py:160
msgid ""
"The raw, text-only data of the document. This field is primarily used for "
"searching."
msgstr ""
#: documents/models.py:165
msgid "mime type"
msgstr ""
#: documents/models.py:176
msgid "checksum"
msgstr ""
#: documents/models.py:180
msgid "The checksum of the original document."
msgstr ""
#: documents/models.py:184
msgid "archive checksum"
msgstr ""
#: documents/models.py:189
msgid "The checksum of the archived document."
msgstr ""
#: documents/models.py:193 documents/models.py:333
msgid "created"
msgstr ""
#: documents/models.py:197
msgid "modified"
msgstr ""
#: documents/models.py:201
msgid "storage type"
msgstr ""
#: documents/models.py:209
msgid "added"
msgstr ""
#: documents/models.py:213
msgid "filename"
msgstr ""
#: documents/models.py:218
msgid "Current filename in storage"
msgstr ""
#: documents/models.py:222
msgid "archive serial number"
msgstr ""
#: documents/models.py:227
msgid "The position of this document in your physical document archive."
msgstr ""
#: documents/models.py:233
msgid "Document"
msgstr ""
#: documents/models.py:234
msgid "Documents"
msgstr ""
#: documents/models.py:324
msgid "group"
msgstr ""
#: documents/models.py:327
msgid "message"
msgstr ""
#: documents/models.py:330
msgid "level"
msgstr ""
#: documents/models.py:337
msgid "log"
msgstr ""
#: documents/models.py:338
msgid "logs"
msgstr ""
#: documents/models.py:349 documents/models.py:399
msgid "saved view"
msgstr ""
#: documents/models.py:350
msgid "saved views"
msgstr ""
#: documents/models.py:353
msgid "user"
msgstr ""
#: documents/models.py:359
msgid "show on dashboard"
msgstr ""
#: documents/models.py:362
msgid "show in sidebar"
msgstr ""
#: documents/models.py:366
msgid "sort field"
msgstr ""
#: documents/models.py:369
msgid "sort reverse"
msgstr ""
#: documents/models.py:375
msgid "title contains"
msgstr ""
#: documents/models.py:376
msgid "content contains"
msgstr ""
#: documents/models.py:377
msgid "ASN is"
msgstr ""
#: documents/models.py:378
msgid "correspondent is"
msgstr ""
#: documents/models.py:379
msgid "document type is"
msgstr ""
#: documents/models.py:380
msgid "is in inbox"
msgstr ""
#: documents/models.py:381
msgid "has tag"
msgstr ""
#: documents/models.py:382
msgid "has any tag"
msgstr ""
#: documents/models.py:383
msgid "created before"
msgstr ""
#: documents/models.py:384
msgid "created after"
msgstr ""
#: documents/models.py:385
msgid "created year is"
msgstr ""
#: documents/models.py:386
msgid "created month is"
msgstr ""
#: documents/models.py:387
msgid "created day is"
msgstr ""
#: documents/models.py:388
msgid "added before"
msgstr ""
#: documents/models.py:389
msgid "added after"
msgstr ""
#: documents/models.py:390
msgid "modified before"
msgstr ""
#: documents/models.py:391
msgid "modified after"
msgstr ""
#: documents/models.py:392
msgid "does not have tag"
msgstr ""
#: documents/models.py:403
msgid "rule type"
msgstr ""
#: documents/models.py:407
msgid "value"
msgstr ""
#: documents/models.py:411
msgid "filter rule"
msgstr ""
#: documents/models.py:412
msgid "filter rules"
msgstr ""
#: paperless/settings.py:253
msgid "English"
msgstr ""
#: paperless/settings.py:254
msgid "German"
msgstr ""