coexcz / django-translation-manager Goto Github PK
View Code? Open in Web Editor NEWDjango app for managing translations from admin
License: Mozilla Public License 2.0
Django app for managing translations from admin
License: Mozilla Public License 2.0
Test project / example app to run unit test on.
Locally all works ok. But when I uploaded all changes in server it's doesn't work.
On server I did migration, check in database new tables was created and loaded strings from po files via shell.
from translation_manager.manager import Manager
m = Manager()
m.load_data_from_po()
# processing pofile /home/ubuntu/project/path/locale/en/LC_MESSAGES/django.po
Then in shell I checked if it register in admin.
from django.contrib import admin
admin.site._registry
# <class 'translation_manager.models.TranslationEntry'>: <translation_manager.admin.TranslationEntryAdmin object at 0x7f8e2089f9b0>,
# <class 'translation_manager.models.TranslationBackup'>: <translation_manager.admin.TranslationBackupAdmin object at 0x7f8e2089f9e8>
Even no link to translations in urls
http://my_site/admin/translation_manager/ - 404
When I access the admin site after making various settings according to the home page (https://www.coex.cz/blog/translation-manager), the screen displaying the string data to be translated does not appear as shown below.
My screen looks like the following, with no data to be translated.
The django.po file has been generated.
Also, when I try to add translation data, the following screen appears, and I can only enter the "Admin-translation_entry-original-label:" part.
Do you know the solution to this problem?
My environment is as follows.
django:ver3.2.3
db:sqlitedb
os:windows10
Django makemessages command reads the comments made with the keyword "Translators": https://docs.djangoproject.com/en/1.10/topics/i18n/translation/#comments-for-translators
django-translation-manager could pick that up and show it in the translating table, on the admin.
Na branchi feature/remote_sync způsobuje migrace 0006_auto_20170915_1529 error:
TypeError: 'class Meta' got invalid attribute(s): indexes
Pomohlo odstranění řádku 22.
The translation_manager.signals.post_save
is sent when the translations are published. It would be better to call it post_publish
for example.
Otherwise TRM does't work as you click on Update translations in Django Admin, there is messege Updated succcessfuly
but nothing happen.
Following options from example raise error.
TRANSLATIONS_CUSTOM_FILTERS = [
('admin-translation_manager-filter-title'),
[
('^admin-', 'admin-'),
('^front-', 'front-_'),
('^email-', 'email-*'),
]
]
this happens, when translation strings are imported through the db but the locale directory structure is not there yet. Example: Import DB from a production system to a local system and then click on 'publish translations'.
I would expect this to work as it works when I create the /locale directory structure without the *.po files. In this case the *.po files are correctly written.
This duality of files is not a very good code practise.
I just installed this package on a project running on python 2.7
and django 1.11
, and I receive the following error:
File "/home/arexons/projects/arexons/arexons_dev/local/lib/python2.7/site-packages/translation_manager/admin.py", line 1, in <module>
from email.policy import HTTP
ImportError: No module named policy
When trying to restore a backup in version 1.1.1 with Python 3, the following happens:
with open(po_filename, 'w') as output:
output.write(self.content.encode('utf-8'))
TypeError: write() argument must be str, not bytes
An option to enable jsx-file parsing for the djangojs domain would be very helpful.
OperationalError: (1093, "You can't specify target table 'translation_manager_translationentry' for update in FROM clause")
caused by: TranslationEntry.objects.filter(original__in=published.values_list('original', flat=True)).update(is_published=True)
MySQL doesn't allow updating the table you are already using in an inner select as the update criteria.
Fix is to wrap published values in list:
TranslationEntry.objects.filter(original__in=list(published.values_list('original', flat=True))).update(is_published=True)
I came here via a search. The readme is missing what this does and why it is useful. If this is an admin feature, please include a screenshot.
I'm using 1.1.1 with python3.8 and django 3.0.4.
# Generated by Django 3.0.4 on 2020-03-24 10:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('translation_manager', '0008_auto_20200120_1735'),
]
operations = [
migrations.AlterModelOptions(
name='translationbackup',
options={'ordering': ('-created',), 'verbose_name': 'Admin-translation_backup-singular', 'verbose_name_plural': 'Admin-translation_backup-plural'},
),
migrations.AlterModelOptions(
name='translationentry',
options={'ordering': ('original',), 'permissions': (('load', 'admin-translation_entry-load-from-po'),), 'verbose_name': 'Admin-translation_entry-singular', 'verbose_name_plural': 'Admin-translation_entry-plural'},
),
]
There should be used get_settings()
method to load value of this variable from project Settings or fallback to default (blank) value in package default Settings.
https://github.com/COEXCZ/django-translation-manager/blob/master/translation_manager/admin.py#L70
extra_context['remote_url'] = get_settings('TRANSLATIONS_SYNC_REMOTE_URL')
ugettext_lazy
is removed in Django 4.0 and should be replaced with gettext_lazy
Having version like 1.4.19 raises error due to version checking
in
translation_manager/management/commands/makemessages.py in handle_noargs
58: if 1.7 > float(django.get_version()) >= 1.6:
I have not performed a full test yet, but following changes seems to fix a startup error when running in Django 1.10
translation_manager/admin.py (function get_urls):
def get_urls(self):
try:
from django.conf.urls import patterns, url
after:
def get_urls(self):
try:
from django.conf.urls import url
urls = patterns('',
url(r'^make/$', wrap(self.make_translations_view), name='%s_%s_make' % info),
url(r'^compile/$', wrap(self.compile_translations_view), name='%s_%s_compile' % info),
url(r'^load_from_po/$', wrap(self.load_from_po_view), name='%s_%s_load' % info),
)
after:
urls = [
url(r'^make/$', wrap(self.make_translations_view), name='%s_%s_make' % info),
url(r'^compile/$', wrap(self.compile_translations_view), name='%s_%s_compile' % info),
url(r'^load_from_po/$', wrap(self.load_from_po_view), name='%s_%s_load' % info),
]
It's not being imported anywhere in the package. You can make it an optional dependency.
It should be in manager.py:store_to_db() around line 60 - two TranslationEntry objects and only one get() call..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.