私はDjango Rosetta v 0.7.6を使用しています(ライブラリとDjangoのバージョンを一致させてWebアプリで動作させるため)。en-us から ar(Arabic) に変換され、ほとんどすべての文字列で機能しますが、一部の文字列が欠落しており、何が問題なのか、すべてが翻訳されていない理由がわかりません。
これは、settings.py ドキュメント内の言語の一部であり、何かを変更する必要がある場合 (または異なる順序にする必要がある場合) のロケール パスです。
TEMPLATE_DIRS = (os.path.join(PACKAGE_ROOT, 'templates'),os.path.join(PACKAGE_ROOT, 'templatetags')) + TEMPLATE_DIRS
LOCALE_PATHS = (os.path.join(PACKAGE_ROOT, '../locale'),)
# If the rosetta library has been installed, and add to INSTALLED_APPS
try:
import rosetta
INSTALLED_APPS += ('rosetta',)
except ImportError:
pass
ugettext = lambda s: s
LANGUAGES = (
('en-us', ugettext('English')),
('ar', ugettext('Arabic')) #Your second language
)
LANGUAGE_CODE = 'en-us' #Your default language
USE_L10N = True
.po ドキュメントは、最初にあいまいな文字列と空の文字列を含むこの行を生成し、その後、バージョンの年の日付についての巨大なジャンボを生成します...そして、文字列を翻訳したドキュメントと 2 つの言語の間の関係を含むリスト全体( #: documet/translated/form.htm:1234, msgid "String in en-us" msgstr "string in ar")。
# 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 ""`
.po のドキュメント全体で、ページで翻訳されていないものが欠落していますが、en-us の元の文字列への言及も表示されません。ポ文書。
次の図は、これらの行、ファイルのログです...未翻訳です。その後、django Rosetta ページの最初のフォームのコード .htm のセクションは、翻訳されておらず、画像に表示されています。
{% extends "views/forms/base.htm" %}
{% load i18n %}
{% block form_content %}
<!-- Resource Type CRUD Form -->
<hr class="divider arches-RDM-divider">
<div id="site_ID-section">
<!-- Name CRUD Form -->
<div class="row">
<div class="col-xs-12">
<div class="padding-left-10">
<dl>
<!-- Title -->
<dt>
<h5 id="arches-names-form" class="section-headline">{% trans "National ID" %}</h5>
</dt>
<!-- Form -->
<dd>
<div class="row">
<div class="col-xs-12 hidden-xs">
<input class="form-control arches-form-input" id="resource-name" style="width: 18%;" placeholder='{% trans "National ID" %}' data-bind='value: getEditedNode("SITE_ID.E42", "value")'>
{% include 'views/components/add-item-button.htm' %}
</div>
<div class="col-xs-12 hidden-sm hidden-md hidden-lg">
<input class="form-control arches-form-input" id="resource-name" style="width: 33%;" placeholder='{% trans "National ID" %}' data-bind='value: getEditedNode("SITE_ID.E42", "value")'>
<div class="margin-top-5"></div>
>
<!-- Spacer (for xs screens) -->
<div class="margin-top-5"></div>
{% include 'views/components/add-item-button.htm' %}
</div>
</div>
</dd>
<!-- End Form -->
</dl>
</div>
</div>
</div>
<!-- End Name CRUD Form Container -->
<!-- Name Records -->
<div class="row">
<div class="col-xs-12">
<!-- -->
<div class="arches-crud-child-section">
<dl>
<dd class="arches-CRUD-child-title">
{% trans "This resource has the following ID code:" %}
</dd>
<dd class="margin-left-5" style="display: none;" data-bind="visible: true">
<div data-bind="visible: getBranchLists().length == 0" class="txt-color-blue">{% trans "No ID Defined" %}</div>
<div data-bind='foreach: getBranchLists()'>
<div class="arches-crud-record">
<a href="javascript:void(0)" class="arches-CRUD-child" title="{% trans "Delete this name" %}"><i data-bind="click: $parent.deleteItem.bind($parent)" class="arches-CRUD-delete fa fa-times-circle"></i></a>
<a href="javascript:void(0)" class="arches-CRUD-child arches-CRUD-edit" data-bind="click: $parent.editItem.bind($parent)" title="{% trans "Edit this name" %}"><span data-bind='text: nodes.get("SITE_ID.E42", "value")' style="padding-right:2px;"></span><span class="text-muted arches-crud-type-identifier"></span>
</a>
</div>
</div>
</dd>
</dl>
</div>
</div>
</div>
翻訳したときと元の言語でどのように見えるかをここに示してください。何が問題なのかをローカライズするのに役立つ場合に備えて、インスタンスとサーバーも再起動しましたが、これを行った後は同じ答えです: