Dear Malcolm Many thanks for your response.
On 03/04/07, Malcolm Tredinnick ([EMAIL PROTECTED]) wrote: > > Hi Rory, > > On Tue, 2007-04-03 at 08:45 +0100, Rory Campbell-Lange wrote: > > We are developing a website for use in 16 EU countries. Some of the > > languages we need to cover are not supported by Django, according to: > > http://www.djangoproject.com/documentation/settings/#languages > > All of our translation strings are in template files and we have > > generated corresponding .po files. > > > > We need to support Polish, and to provide an example translation in > > Afrikaans (language code 'af'), for which we have provided a translation > > and generated $PROJECTPATH/locale/af/LC_MESSAGES/django.mo > > > > I have tried generating the django.mo file for Afrikaans, setting > > LANGUAGE_CODE = 'af' and restarting Apache. No luck. I've also tried to > > list Afrikaans using the "dummy gettext() function" as described at > > http://www.djangoproject.com/documentation/i18n/ with no success. > > > > Help gratefully received. > > Not sure if you noticed this note in the docs, but your application can > only support translations that are "known" to Django's core as well. So, > out of the box you are restricted to the list under django/conf/locale/. > See > http://www.djangoproject.com/documentation/i18n/#how-to-create-language-files > . > > The good news is that it's easy enough to add an extra locale to the > core so that your application can support that locale. You will need to > modify your Django source for this. At the moment there isn't a way > around that. I might get around to fixing this one day (or somebody else > might, which would be great, but at the moment, I seem to be the > de-facto i18n maintainer), but it's relatively low priority at the > moment -- partly because we'd like to encourage translations of Django's > core. > > To add an extra locale to Django, do the following (I'll use "af" as the > example): > > (1) In the django/ directory, run bin/make-messages.py -l af. > This will create django/conf/locale/af/LC_MESSAGES/django.po and > djangojs.po in the same directory. > > (2) In the django/ directory, run bin/compile-messages.py -l af > to generate the corresponding .mo files. > > (3) Add an entry for 'af' either in > django/conf/global_settings.py (in the LANGUAGES list) or in > your own settings file. Hugely helpful. Many, many thanks. I will try this out and report back. > This creates an empty translation file for the Django core. It doesn't > add any value to your translations, but it does mean that your > project/application translation files will be used for your app-specific > strings. At this point, you should be good to go by settings > LANGUAGE_CODE and so forth. > > Note that the reference to "dummy gettext()" in the docs is just saying > that you should avoid using the real (imported) gettext() function in > that file. Just copy what global_settings.py does if you want that. We > mark all the language names as translatable in global_settings.py, for > example. I think I understand -- I'll stick to standard imported gettext where I can. Many thanks again; Regards, Rory -- Rory Campbell-Lange <[EMAIL PROTECTED]> <www.campbell-lange.net> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

