-
Notifications
You must be signed in to change notification settings - Fork 6
Adding a Locale to Phaidra (i18n)
- Interface localization (HTML and Javascript Templates, Javascript)
- Content localization (Admin)
- Save your work!
- Adding a translated (and aligned) work
Open up phaidra/settings.py. In the section LANGUAGES, add the language:
LANGUAGES = (
('en', 'English'),
('fa', 'Farsi'),
('de', 'German'),
('it', 'Italian'),
('hr', 'Croatian')
)
From the root directory of the project, run:
$ fab prepare_locale:de
Replace 'de' with the two-letter locale code. This command is rather slow, so just be patient 😄
Open /opt/phaidra/locale/*/LC_MESSAGES/django.po
, where * is the locale code you are interested in. You will find sets of strings which look something like this:
# templates/something.html:123
msgid "Words in English"
msgstr "Wörter auf Deutsch"
The msgid
is always the original in the file, and the msgstr
is your translation. Simply go through this document and translate the English into your target language.
Once you've translated the strings in django.po and djangojs.po, you need to compile them.
$ fab compile_locale:de
Replace 'de' with the two-letter locale code.
Log in to the Phaidra Admin. You will need to create items within the following App categories:
- Languages
- Content
Simply assign the language you're working on to the Content you create, and it will show up on the interface when the language is selected.
When you go to YOUR_IP_ADDRESS:8000/*/lessons/
, you will see which lessons still need content.
In order to propagate the changes you've made within the admin panel to github, so others can load in your content as well, run the following command.
fab propagate_db
git add app/fixtures/db.json && git add locale
Run git status
to confirm that your changes are properly staged, then git commit and push as usual.
This workflow will be improved very soon
-
Copy your XML file into
common/utils/neo4j_import/data
. -
Open up
common/utils/neo4j_import/import_alignment.py
and add an entry to theLANGUAGES
dictionary. At the time of writing, it looks like this:
languages = {
'en': Document('Thucydides', 'The Pentecontaetia', 'eng', 'en',
'urn:cts:greekLit:tlg0003.tlg001.perseus-grc'),
'fa': Document('ﺕﻮﺳیﺩیﺩ', 'ﺕﺍﺭیﺥ پﻦﺟﺎﻫ ﺱﺎﻟ گﺬﺸﺘﻫ', 'fas', 'fa',
'urn:cts:greekLit:tlg0003.tlg001.perseus-grc'),
'hr': Document('Tukidid', 'Povijest Peloponeskograta', 'hrv', 'hr',
'urn:cts:greekLit:tlg0003.tlg001.perseus-grc')
}
Simply add another entry with the data in order: Author language, Translated Work, 3-letter language code, 2-letter language code, source URN.
-
From the root directory, run fab with your choosen language as parameter, e.g.
fab import_alignment:lang='en'
. -
optional: you can also run
fab import_alignment:lang='all'
if you want to run all alignment data at once.
- Developer tools and workflow
- API
- Neo4j-powered
- Postgres-powered
- Data
- Internationalization
- General information
- Developer tools and workflow
- Project structure overview
- Frontend vs. Backend Templates
- Backbone.js app structure
- Internationalization for JS
- Guidelines for creating content
- Adding a locale to Phaidra
- Postgres Database
- Neo4j
- Django
- "The server"
- Git
- UI