Thursday, August 30, 2018

Re: New language adding error('Unknown language code si.')

Hello Deniz Bazan

I fixed that issue with override Django locale file. you can try to setting up file this your file 

    'si': {
        'bidi': False,
        'code': 'si',
        'name': 'Sinhala',
        'name_local': 'සිංහල',
'en': {
        'bidi': False,
        'code': 'en',
        'name': 'English',
        'name_local': 'English',

On Thursday, August 9, 2018 at 9:01:58 PM UTC+5:30, Deniz Bazan wrote:
Hi Kumara, did you  find a solution for your question, because i have same problem. 

Am Montag, 30. April 2018 14:04:01 UTC+2 schrieb lakshitha kumara:
Hello Jason,

Thanks you for your reply but unfortunately that example not working any more with django 2 and python 3 .


On Monday, April 30, 2018 at 7:47:45 AM UTC+5:30, lakshitha kumara wrote:
Hello Guys 

I added new language to django . language called Sinhala. My code is look like this.

On settings page 

    ('si', _('Sinhala')),
    ('en', _('English')),

USE_I18N = True

USE_L10N = True

USE_TZ = True

    os.path.join(os.path.dirname(__file__), "../locale"),

On locale folder

    'si': {
        'bidi': False,
        'code': 'si',
        'name': 'Sinhala',
        'name_local': 'Sinhala',
I ran this command after that makemessages -l si compilemessages

When i goes to admin URL with sinhala language its working fine i try get all supported language give this error 
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}      <input name="next" type="hidden" value="{{ redirect_to }}" />      <select name="language">          {% get_current_language as LANGUAGE_CODE %}          {% get_available_languages as LANGUAGES %}          {% get_language_info_list for LANGUAGES as languages %}          {% for language in languages %}              <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>                  {{ language.name_local }} ({{ language.code }})              </option>          {% endfor %}      </select>      <input type="submit" value="Go" />  </form>

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment