Manage separate translation files (.po) in Django

I am not an expert in Python or gettext utilities. I have a Django project in which I have several modules in the application. I need to maintain separate .po translation files for each module that will be merged in the time deployment. For instance, there is a Dictionary module beside the django-cms-2 module for both of which I want to have different .po files (such as dict.po and django-cms-master.po). Then, I will use msgmerge and compilemessages from gettext and Django to create the final django.mo file. Is there any solution for what I need?

Answers


Here's my quick hack to merge multiple .po-files under locale/LOCALE_CODE/ into locale/LOCALE_CODE/LC_MESSAGES/django.po

#!/bin/bash

# quick hack to merge all .po-files found under ./locale/LOCALE/
# to a django.po-file and then compile the django.po to django.mo

for l in locale/*
do
    bn=$(basename $l)
    echo "translating locale $bn"
    cat $l/*.po > $l/LC_MESSAGES/django.po
    python manage.py compilemessages -l $bn
done

Need Your Help

How can I avoid changes in DB while making a set of queries?

java mysql spring jpa transactions

In my web application (Java + Spring + JPA) I have a method executing a set of related queries. In particular I need to know the total row count of a table and the row count of the result set for a