Showing posts with label locale. Show all posts
Showing posts with label locale. Show all posts

Monday, 12 January 2015

Django - Translation check list

1. Mark your text for translation. ex: a. In template: using {% load i18n %} (at the top but have to be after the 'extends' tag) and {% trans 'text to be translated' %} b. in your code: from django.utils.translation import ugettext as _ ; _('Your text to be translated here') 2. Build the message file for language translations (creating .po files: ./manage makemessages -l vi (my django-admin.py doesn't work for me) You can run this again to reexamine the other text 3. Compile messages files ./manage compilemessages (do this again after you make changes to your po file 4. settings file LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale'), ) LANGUAGE_CODE = 'vi' 5. use URL international with i18n_patterns and set_length() add django.middleware.locale.LocaleMiddleware to MIDDLEWARE_CLASSES Use this form to set user's language preference
{% csrf_token %}
6.Others: TEMPLATE_CONTEXT_PROCESSORS += ( 'django.core.context_processors.request', ) add this to use request.get_full_path in your template

Friday, 9 January 2015

Activating Unicode/UTF-8 Support and Changing Default Locale Language in Slackware

Source: http://gnu-linux-slackware.blogspot.com/2009/06/changing-system-wide-default-language.html For a list of locales which are supported by your Slackware box, type: $ locale -a If you have full installation of Slackware, all languages will be listed. To get UTF-8 support, edit lang.sh file as root by: # nano /etc/profile.d/lang.sh Comment default locale and add uncommented line export LANG=en_US.UTF-8 After modifying lang.sh file, save it and reboot your computer.