Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

translation.E004) You have provided a value for the LANGUAGE_CODE setting that is not in the LANGUAGES setting

I've just reimaged my computer, so setting everything back up for my django project, and on running the server, I get this error. I haven't a clue what it is referring to as my original site came out of the box and as I speak English and this site is an internal work site, there is no reason to do anything language based. Does anyone know what this is or how to get past it so I can carry on working? Looking in the settings file, I have this for the Internationalization section:

LANGUAGE_CODE = 'en-GB'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

DATE_INPUT_FORMATS = [
    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
]

Is this the out of the box English code? if not, could someone tell me what is should be so I can set it back please, I can't find the outofthebox settings in the documentation.

like image 216
iFunction Avatar asked Dec 03 '19 11:12

iFunction


2 Answers

In Django 3.0 you should use LANGUAGE_CODE exactly as mentioned in LANGUAGES list located in django/conf/global_settings.py

The list is a list of two-tuples in the format (language code, language name) – for example, ('ja', 'Japanese'). This specifies which languages are available for language selection.

So, in your case, it will be LANGUAGE_CODE = 'en-gb'

like image 186
dtar Avatar answered Nov 01 '22 03:11

dtar


For French-speaking people, you have to change 'fr-fr' to 'fr'

like image 3
raphodn Avatar answered Nov 01 '22 04:11

raphodn