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

2018-08-30 Thread lakshitha kumara
Hello Bazan

you can be fixed this issue this override Django locale file. setting up 
your settings.py file like the below.

EXTRA_LANG_INFO = {
'si': {
'bidi': False,
'code': 'si',
'name': 'Sinhala',
'name_local': 'සිංහල',
},
'en': {
'bidi': False,
'code': 'en',
'name': 'English',
'name_local': 'English',
},
}
LANG_INFO = dict(EXTRA_LANG_INFO.items())
django.conf.locale.LANG_INFO = LANG_INFO

LANGUAGE_CODE = 'en'
LANGUAGES = [
('en', _('English')),
('si', _('Sinhala')),
]

This one fixed the issue. should remember to add all language details your 
using to EXTRA_LANG_INFO variable 

Thanks

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 .*
>>
>>
>> *Thanks*
>> 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 
>>>
>>> LANGUAGE_CODE = 'en'
>>> LANGUAGES = [
>>> ('si', _('Sinhala')),
>>> ('en', _('English')),
>>> ]
>>> TIME_ZONE = 'UTC'
>>>
>>> USE_I18N = True
>>>
>>> USE_L10N = True
>>>
>>> USE_TZ = True
>>>
>>> LOCALE_PATHS = (
>>> os.path.join(os.path.dirname(__file__), "../locale"),
>>> )
>>>
>>> On locale folder 
>>>
>>> __init__.py
>>>
>>> LANG_INFO = {
>>> 'si': {
>>> 'bidi': False,
>>> 'code': 'si',
>>> 'name': 'Sinhala',
>>> 'name_local': 'Sinhala',
>>> },
>>> }
>>> I ran this command after that 
>>>
>>> manage.py makemessages -l si
>>> manage.py compilemessages
>>>
>>>
>>> When i goes to admin URL with sinhala language its working fine i try get 
>>> all supported language give this error 
>>>
>>> {% csrf_token %}
>>> 
>>> 
>>> {% get_current_language as LANGUAGE_CODE %}
>>> {% get_available_languages as LANGUAGES %}
>>> {% get_language_info_list for LANGUAGES as languages %}
>>> {% for language in languages %}
>>> >> LANGUAGE_CODE %} selected{% endif %}>
>>> {{ language.name_local }} ({{ language.code }})
>>> 
>>> {% endfor %}
>>> 
>>> 
>>> 
>>>
>>>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81891d8c-aec9-427f-8bc8-3cb35e387153%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-08-30 Thread lakshitha kumara
Hello Deniz Bazan

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

*EXTRA_LANG_INFO = {*
*'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 .*
>>
>>
>> *Thanks*
>> 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 
>>>
>>> LANGUAGE_CODE = 'en'
>>> LANGUAGES = [
>>> ('si', _('Sinhala')),
>>> ('en', _('English')),
>>> ]
>>> TIME_ZONE = 'UTC'
>>>
>>> USE_I18N = True
>>>
>>> USE_L10N = True
>>>
>>> USE_TZ = True
>>>
>>> LOCALE_PATHS = (
>>> os.path.join(os.path.dirname(__file__), "../locale"),
>>> )
>>>
>>> On locale folder 
>>>
>>> __init__.py
>>>
>>> LANG_INFO = {
>>> 'si': {
>>> 'bidi': False,
>>> 'code': 'si',
>>> 'name': 'Sinhala',
>>> 'name_local': 'Sinhala',
>>> },
>>> }
>>> I ran this command after that 
>>>
>>> manage.py makemessages -l si
>>> manage.py compilemessages
>>>
>>>
>>> When i goes to admin URL with sinhala language its working fine i try get 
>>> all supported language give this error 
>>>
>>> {% csrf_token %}
>>> 
>>> 
>>> {% get_current_language as LANGUAGE_CODE %}
>>> {% get_available_languages as LANGUAGES %}
>>> {% get_language_info_list for LANGUAGES as languages %}
>>> {% for language in languages %}
>>> >> LANGUAGE_CODE %} selected{% endif %}>
>>> {{ language.name_local }} ({{ language.code }})
>>> 
>>> {% endfor %}
>>> 
>>> 
>>> 
>>>
>>>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7175788d-456f-4535-b8b6-ab63839a1005%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-08-09 Thread Deniz Bazan
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 .*
>
>
> *Thanks*
> 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 
>>
>> LANGUAGE_CODE = 'en'
>> LANGUAGES = [
>> ('si', _('Sinhala')),
>> ('en', _('English')),
>> ]
>> TIME_ZONE = 'UTC'
>>
>> USE_I18N = True
>>
>> USE_L10N = True
>>
>> USE_TZ = True
>>
>> LOCALE_PATHS = (
>> os.path.join(os.path.dirname(__file__), "../locale"),
>> )
>>
>> On locale folder 
>>
>> __init__.py
>>
>> LANG_INFO = {
>> 'si': {
>> 'bidi': False,
>> 'code': 'si',
>> 'name': 'Sinhala',
>> 'name_local': 'Sinhala',
>> },
>> }
>> I ran this command after that 
>>
>> manage.py makemessages -l si
>> manage.py compilemessages
>>
>>
>> When i goes to admin URL with sinhala language its working fine i try get 
>> all supported language give this error 
>>
>> {% csrf_token %}
>> 
>> 
>> {% get_current_language as LANGUAGE_CODE %}
>> {% get_available_languages as LANGUAGES %}
>> {% get_language_info_list for LANGUAGES as languages %}
>> {% for language in languages %}
>> > LANGUAGE_CODE %} selected{% endif %}>
>> {{ language.name_local }} ({{ language.code }})
>> 
>> {% endfor %}
>> 
>> 
>> 
>>
>>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/145f6cc1-2b36-4273-9cf5-0c3f70889e63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-04-30 Thread lakshitha kumara
Hello Jason,

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


*Thanks*
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 
>
> LANGUAGE_CODE = 'en'
> LANGUAGES = [
> ('si', _('Sinhala')),
> ('en', _('English')),
> ]
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
> LOCALE_PATHS = (
> os.path.join(os.path.dirname(__file__), "../locale"),
> )
>
> On locale folder 
>
> __init__.py
>
> LANG_INFO = {
> 'si': {
> 'bidi': False,
> 'code': 'si',
> 'name': 'Sinhala',
> 'name_local': 'Sinhala',
> },
> }
> I ran this command after that 
>
> manage.py makemessages -l si
> manage.py compilemessages
>
>
> When i goes to admin URL with sinhala language its working fine i try get all 
> supported language give this error 
>
> {% csrf_token %}
> 
> 
> {% get_current_language as LANGUAGE_CODE %}
> {% get_available_languages as LANGUAGES %}
> {% get_language_info_list for LANGUAGES as languages %}
> {% for language in languages %}
>  LANGUAGE_CODE %} selected{% endif %}>
> {{ language.name_local }} ({{ language.code }})
> 
> {% endfor %}
> 
> 
> 
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/055aee4e-5ff7-42fb-b6ad-7e40d967f760%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-04-30 Thread Jason
The reason is that language code is not supported by django, but there's a 
procedure to add custom languages.

https://github.com/deschler/django-modeltranslation/issues/364#issuecomment-193182171

Specifically, this StackOverflow post 

 describes 
the method to add the translation files, but you also need those 
translation files from somewhere.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb51d566-de82-411e-b784-f9f5664cda97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-04-30 Thread lakshitha kumara
Hello guys sorry this is the error.

KeyError at /accounts/login/

'Unknown language code si.'

Request Method: GET
Request URL: http://localhost.test:8000/accounts/login/
Django Version: 2.0.4
Exception Type: KeyError
Exception Value: 

'Unknown language code si.'

Exception Location: 
E:\HiveProject\DjangoWeb\lib\site-packages\django\utils\translation\__init__.py 
in get_language_info, line 244
Python Executable: E:\HiveProject\DjangoWeb\Scripts\python.exe
Python Version: 3.6.4
Python Path: 

['E:\\HiveProject\\DjangoWeb\\hive',
 'E:\\HiveProject\\DjangoWeb\\Scripts\\python36.zip',
 'E:\\HiveProject\\DjangoWeb\\DLLs',
 'E:\\HiveProject\\DjangoWeb\\lib',
 'E:\\HiveProject\\DjangoWeb\\Scripts',
 'c:\\python36\\Lib',
 'c:\\python36\\DLLs',
 'E:\\HiveProject\\DjangoWeb',
 'E:\\HiveProject\\DjangoWeb\\lib\\site-packages']

Server time: Mon, 30 Apr 2018 06:34:03 +
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 
>
> LANGUAGE_CODE = 'en'
> LANGUAGES = [
> ('si', _('Sinhala')),
> ('en', _('English')),
> ]
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
> LOCALE_PATHS = (
> os.path.join(os.path.dirname(__file__), "../locale"),
> )
>
> On locale folder 
>
> __init__.py
>
> LANG_INFO = {
> 'si': {
> 'bidi': False,
> 'code': 'si',
> 'name': 'Sinhala',
> 'name_local': 'Sinhala',
> },
> }
> I ran this command after that 
>
> manage.py makemessages -l si
> manage.py compilemessages
>
>
> When i goes to admin URL with sinhala language its working fine i try get all 
> supported language give this error 
>
> {% csrf_token %}
> 
> 
> {% get_current_language as LANGUAGE_CODE %}
> {% get_available_languages as LANGUAGES %}
> {% get_language_info_list for LANGUAGES as languages %}
> {% for language in languages %}
>  LANGUAGE_CODE %} selected{% endif %}>
> {{ language.name_local }} ({{ language.code }})
> 
> {% endfor %}
> 
> 
> 
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c746d89-2e35-40a8-aa83-3dbf39bc872f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-04-29 Thread lakshitha kumara
Hello Guys 

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

On settings page 

LANGUAGE_CODE = 'en'
LANGUAGES = [
('si', _('Sinhala')),
('en', _('English')),
]
TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

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

On locale folder 

__init__.py

LANG_INFO = {
'si': {
'bidi': False,
'code': 'si',
'name': 'Sinhala',
'name_local': 'Sinhala',
},
}
I ran this command after that 

manage.py makemessages -l si
manage.py compilemessages


When i goes to admin URL with sinhala language its working fine i try get all 
supported language give this error 

{% csrf_token %}


{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}

{{ language.name_local }} ({{ language.code }})

{% endfor %}




-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2f328be0-d237-4b02-b266-718891a06001%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.