kopia lustrzana https://github.com/jedie/PyInventory
Add de/en translations
rodzic
20d673a0cf
commit
54b5b2a729
|
@ -53,7 +53,6 @@ coverage.xml
|
|||
*,cover
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
|
|
4
Makefile
4
Makefile
|
@ -77,6 +77,10 @@ publish: ## Release new version to PyPi
|
|||
run-dev-server: ## Run the django dev server in endless loop.
|
||||
./manage.sh runserver
|
||||
|
||||
messages: ## Make and compile locales message files
|
||||
./manage.sh makemessages --all
|
||||
./manage.sh compilemessages
|
||||
|
||||
run-server: ## Run the gunicorn server in endless loop.
|
||||
poetry run inventory run-server
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
"""
|
||||
Auto fill "verbose_name" translations:
|
||||
Just copy the model field name as translation.
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
MESSAGE_MAP = {
|
||||
'id': 'ID',
|
||||
}
|
||||
|
||||
|
||||
def fill(po_file_path):
|
||||
old_content = []
|
||||
new_content = []
|
||||
with po_file_path.open('r') as f:
|
||||
for line in f:
|
||||
old_content.append(line)
|
||||
|
||||
if line.startswith('msgid "'):
|
||||
msgstr = ''
|
||||
msgid = line[7:-2]
|
||||
try:
|
||||
model, attribute, kind = msgid.strip().split('.')
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
if kind == 'verbose_name':
|
||||
if attribute in MESSAGE_MAP:
|
||||
msgstr = MESSAGE_MAP[attribute]
|
||||
else:
|
||||
words = attribute.replace('_', ' ').split(' ')
|
||||
msgstr = ' '.join(i.capitalize() for i in words)
|
||||
elif kind == 'help_text':
|
||||
msgstr = ' ' # "hide" empty "help_text"
|
||||
|
||||
elif (line == 'msgstr ""\n' or line == 'msgstr " "\n') and msgstr:
|
||||
line = f'msgstr "{msgstr}"\n'
|
||||
|
||||
line = line.replace('Content Tonie', 'Content-Tonie')
|
||||
new_content.append(line)
|
||||
|
||||
if new_content == old_content:
|
||||
print('Nothing to do, ok.')
|
||||
return
|
||||
|
||||
with po_file_path.open('w') as f:
|
||||
f.write(''.join(new_content))
|
||||
|
||||
print(f'updated: {po_file_path}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for dir in ('de', 'en'):
|
||||
print('_' * 100)
|
||||
print(dir)
|
||||
fill(Path(f'locale/{dir}/LC_MESSAGES/django.po'))
|
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,115 @@
|
|||
# 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.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-10-16 19:49+0200\n"
|
||||
"PO-Revision-Date: 2020-10-16 19:56+0200\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Last-Translator: Jens Diemer\n"
|
||||
"Language-Team: \n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
|
||||
#: inventory/models/base.py:15
|
||||
msgid "BaseModel.id.verbose_name"
|
||||
msgstr "ID"
|
||||
|
||||
#: inventory/models/base.py:16
|
||||
msgid "BaseModel.id.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/base.py:23
|
||||
msgid "BaseModel.user.verbose_name"
|
||||
msgstr "Benutzer"
|
||||
|
||||
#: inventory/models/base.py:24
|
||||
msgid "BaseModel.user.help_text"
|
||||
msgstr "Der Benutzer dem dieser Eintrag gehört und verwalten kann (Wird automatisch gesetzt)"
|
||||
|
||||
#: inventory/models/base.py:28
|
||||
msgid "BaseModel.name.verbose_name"
|
||||
msgstr "Name"
|
||||
|
||||
#: inventory/models/base.py:29
|
||||
msgid "BaseModel.name.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/base.py:35
|
||||
msgid "BaseModel.tags.verbose_name"
|
||||
msgstr "Tags"
|
||||
|
||||
#: inventory/models/base.py:36
|
||||
msgid "BaseModel.tags.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/item.py:14
|
||||
msgid "ItemModel.description.verbose_name"
|
||||
msgstr "Beschreibung"
|
||||
|
||||
#: inventory/models/item.py:15
|
||||
msgid "ItemModel.description.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/item.py:20
|
||||
msgid "ItemModel.fcc_id.verbose_name"
|
||||
msgstr "FCC ID"
|
||||
|
||||
#: inventory/models/item.py:21
|
||||
msgid "ItemModel.fcc_id.help_text"
|
||||
msgstr "Eindeutige Nummer der FCC"
|
||||
|
||||
#: inventory/models/item.py:26
|
||||
msgid "ItemModel.location.verbose_name"
|
||||
msgstr "Standort"
|
||||
|
||||
#: inventory/models/item.py:27
|
||||
msgid "ItemModel.location.help_text"
|
||||
msgstr "Wo ist dieser Gegenstand eingelagert?"
|
||||
|
||||
#: inventory/models/item.py:34
|
||||
msgid "ItemModel.verbose_name"
|
||||
msgstr "Gegenstand"
|
||||
|
||||
#: inventory/models/item.py:35
|
||||
msgid "ItemModel.verbose_name_plural"
|
||||
msgstr "Gegenstände"
|
||||
|
||||
#: inventory/models/location.py:14
|
||||
msgid "LocationModel.description.verbose_name"
|
||||
msgstr "Beschreibung"
|
||||
|
||||
#: inventory/models/location.py:15
|
||||
msgid "LocationModel.description.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/location.py:21
|
||||
msgid "LocationModel.parent.verbose_name"
|
||||
msgstr "Übergeordneter Standort"
|
||||
|
||||
#: inventory/models/location.py:22
|
||||
msgid "LocationModel.parent.help_text"
|
||||
msgstr "Standorte können verschachtelt werden. Bsp: Der Karton 12 in Schrank 3"
|
||||
|
||||
#: inventory/models/location.py:29
|
||||
msgid "LocationModel.verbose_name"
|
||||
msgstr "Standort"
|
||||
|
||||
#: inventory/models/location.py:30
|
||||
msgid "LocationModel.verbose_name_plural"
|
||||
msgstr "Standorte"
|
||||
|
||||
#: inventory_project/settings.py:110
|
||||
msgid "German"
|
||||
msgstr ""
|
||||
|
||||
#: inventory_project/settings.py:111
|
||||
msgid "English"
|
||||
msgstr ""
|
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,115 @@
|
|||
# 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.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-10-16 19:49+0200\n"
|
||||
"PO-Revision-Date: 2020-10-16 19:58+0200\n"
|
||||
"Language: en\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Last-Translator: Jens Diemer\n"
|
||||
"Language-Team: \n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
|
||||
#: inventory/models/base.py:15
|
||||
msgid "BaseModel.id.verbose_name"
|
||||
msgstr "ID"
|
||||
|
||||
#: inventory/models/base.py:16
|
||||
msgid "BaseModel.id.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/base.py:23
|
||||
msgid "BaseModel.user.verbose_name"
|
||||
msgstr "User"
|
||||
|
||||
#: inventory/models/base.py:24
|
||||
msgid "BaseModel.user.help_text"
|
||||
msgstr "The user who is the owner of this entry and can manage it (will be set automatically)"
|
||||
|
||||
#: inventory/models/base.py:28
|
||||
msgid "BaseModel.name.verbose_name"
|
||||
msgstr "Name"
|
||||
|
||||
#: inventory/models/base.py:29
|
||||
msgid "BaseModel.name.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/base.py:35
|
||||
msgid "BaseModel.tags.verbose_name"
|
||||
msgstr "Tags"
|
||||
|
||||
#: inventory/models/base.py:36
|
||||
msgid "BaseModel.tags.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/item.py:14
|
||||
msgid "ItemModel.description.verbose_name"
|
||||
msgstr "Description"
|
||||
|
||||
#: inventory/models/item.py:15
|
||||
msgid "ItemModel.description.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/item.py:20
|
||||
msgid "ItemModel.fcc_id.verbose_name"
|
||||
msgstr "FCC ID"
|
||||
|
||||
#: inventory/models/item.py:21
|
||||
msgid "ItemModel.fcc_id.help_text"
|
||||
msgstr "Unique number from the FCC"
|
||||
|
||||
#: inventory/models/item.py:26
|
||||
msgid "ItemModel.location.verbose_name"
|
||||
msgstr "Location"
|
||||
|
||||
#: inventory/models/item.py:27
|
||||
msgid "ItemModel.location.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/item.py:34
|
||||
msgid "ItemModel.verbose_name"
|
||||
msgstr "Item"
|
||||
|
||||
#: inventory/models/item.py:35
|
||||
msgid "ItemModel.verbose_name_plural"
|
||||
msgstr "Items"
|
||||
|
||||
#: inventory/models/location.py:14
|
||||
msgid "LocationModel.description.verbose_name"
|
||||
msgstr "Description"
|
||||
|
||||
#: inventory/models/location.py:15
|
||||
msgid "LocationModel.description.help_text"
|
||||
msgstr " "
|
||||
|
||||
#: inventory/models/location.py:21
|
||||
msgid "LocationModel.parent.verbose_name"
|
||||
msgstr "Parent"
|
||||
|
||||
#: inventory/models/location.py:22
|
||||
msgid "LocationModel.parent.help_text"
|
||||
msgstr "Locations can be nested. Example: The box 12 in cupboard 3"
|
||||
|
||||
#: inventory/models/location.py:29
|
||||
msgid "LocationModel.verbose_name"
|
||||
msgstr "Location"
|
||||
|
||||
#: inventory/models/location.py:30
|
||||
msgid "LocationModel.verbose_name_plural"
|
||||
msgstr "Locations"
|
||||
|
||||
#: inventory_project/settings.py:110
|
||||
msgid "German"
|
||||
msgstr ""
|
||||
|
||||
#: inventory_project/settings.py:111
|
||||
msgid "English"
|
||||
msgstr ""
|
Ładowanie…
Reference in New Issue