第三方应用程序的Django翻译 [英] Django translations of third party apps

查看:68
本文介绍了第三方应用程序的Django翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试翻译Django第三方应用程序( django-recurrence )在我的Django 1.7项目中.尽管我已经在这里阅读了有关同一问题的所有答案,但我仍然无法让Django为该应用程序生成django.po.

I'm trying to translate a Django third-party app (django-recurrence) within my Django 1.7 project. Despite all the answers I've been reading here about the same problem, I'm still being unable to have Django generate the django.po for this app.

这些是我当前的设置:

settings.py

LANGUAGE_CODE = 'it-IT'
gettext = lambda s: s
LANGUAGES = (
    ('en-us', gettext('English')),
    ('it-it', gettext('Italian')),
)

LOCALE_PATHS = (
    '/home/seether/.virtualenvs/mytime/lib/python2.7/site-packages/recurrence/locale',)

TIME_ZONE = 'Europe/Rome'

USE_I18N = True

USE_L10N = True

我尝试了几种修改LOCALE_PATHS的方法,例如:

I've tried modifying LOCALE_PATHS in several ways, like:

LOCALE_PATHS = (os.path.join(BASE_DIR,'locale-recurrence'))
LOCALE_PATHS = (os.path.join(BASE_DIR,'locale'))
...

,依此类推.我已经从该应用程序手动翻译了django.po,尝试将其复制到此类目录中,使其与我不时尝试的设置相对应,但从未成功.我尝试将LANGUAGES和LANGUAGE_CODE更改为以下几乎所有可能的组合:"it","it-it","it_it","it-IT"和"it_IT".也没用.

and so on. I've manually translated the django.po from this app tried copying it in such directories accordingly to the settings I was trying time by time, but it never worked. I've tried changing LANGUAGES and LANGUAGE_CODE to almost every possible combination among: 'it', 'it-it', 'it_it', 'it-IT' and 'it_IT'. Didn't work either.

命令:

django-admin.py makemessages --all

只会为Django本身生成语言环境文件,而完全忽略了我要翻译的应用程序.我也尝试过使用django-rosetta,但是老实说,我自己已经翻译了该应用程序,所以我不能说要加深这条路.基本上,我认为找到正确的方法来简单地告诉Django编译我为django-recurrence编写的django.po并使用它就足够了.

would only produce locale files for Django itself, totally ignoring the app I want to translate. I've tried using django-rosetta as well, but I can't honestly tell to have deepen this path too much, having already translated the app myself. Basically, I think that finding the correct way of simply telling Django to compile the django.po I've written for django-recurrence and using it should be enough.

我在这里想念什么?

推荐答案

我的答案试图将 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆