Merge branch 'main' into release

This commit is contained in:
Cayo Puigdefabregas 2024-03-19 12:41:22 +01:00
commit c6f534d2f8
5 changed files with 15 additions and 4 deletions

View file

@ -1021,7 +1021,10 @@ class SchemasImportAddView(SchemasMix):
def get_description(self):
for des in json.loads(self.get_template_description()).get('description', []):
if settings.LANGUAGE_CODE == des.get('lang'):
lang = settings.LANGUAGE_CODE
if lang == 'ca':
lang = 'ca_ES'
if lang == des.get('lang'):
return des.get('value', '')
return ''

View file

@ -537,7 +537,7 @@ class Schemas(models.Model):
if request:
language_code = request.LANGUAGE_CODE
if self._is_catalan_code(language_code):
language_code = 'ca'
language_code = 'ca_ES'
return language_code
@ -549,7 +549,7 @@ class Schemas(models.Model):
return None
def _is_catalan_code(self, language_code):
return language_code == 'ca_ES'
return language_code == 'ca'
@name.setter
def name(self, value):

View file

@ -36,6 +36,7 @@ class KeyFirstTimeTest(TestCase):
settings.DOMAIN = self.org.name
settings.ENABLE_EMAIL = False
settings.LANGUAGE_CODE = 'en'
def set_cache(self):
cache.set("KEY_DIDS", '1234', None)
@ -94,6 +95,7 @@ class CredentialsViewTest(TestCase):
settings.DOMAIN = self.org.name
settings.ENABLE_EMAIL = False
settings.LANGUAGE_CODE = 'en'
self.admin_login()
self.create_schemas()

View file

@ -12,6 +12,7 @@ from django.core.exceptions import FieldError
from idhub_auth.models import User
from idhub.admin.tables import DashboardTable, UserTable, TemplateTable
from idhub.models import Event, Membership, Rol, UserRol, Service, Schemas
from oidc4vp.models import Organization
class AdminDashboardTableTest(TestCase):
@ -22,6 +23,10 @@ class AdminDashboardTableTest(TestCase):
password='adminpass12')
self.admin_user.accept_gdpr=True
self.admin_user.save()
self.org = Organization.objects.create(name="testserver", main=True)
settings.LANGUAGE_CODE = 'en'
settings.DOMAIN = self.org.name
settings.ENABLE_EMAIL = False
@classmethod
def setUpTestData(cls):

View file

@ -197,12 +197,13 @@ LOCALE_PATHS = [
]
# LANGUAGE_CODE="en"
# LANGUAGE_CODE="es"
LANGUAGE_CODE="en"
LANGUAGE_CODE = config('LANGUAGE_CODE', "ca")
gettext = lambda s: s
LANGUAGES = (
('de', gettext('German')),
('en', gettext('English')),
('ca', gettext('Catalan')),
('es', gettext('Spanish')),
)
USE_I18N = True
USE_L10N = True