From e7e9ab8052be3d6609dcb22f7b900a56a2299a3a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sun, 12 Feb 2023 12:32:23 +0100 Subject: [PATCH 1/3] Allow to pass several language codes to the exercise search See #1238 --- wger/exercises/api/views.py | 52 ++++++------ wger/exercises/fixtures/test-exercises.json | 2 +- wger/exercises/tests/test_search_api.py | 92 +++++++++++++++++++++ wger/utils/language.py | 8 +- 4 files changed, 122 insertions(+), 32 deletions(-) create mode 100644 wger/exercises/tests/test_search_api.py diff --git a/wger/exercises/api/views.py b/wger/exercises/api/views.py index 1fde6113c..02aae5aef 100644 --- a/wger/exercises/api/views.py +++ b/wger/exercises/api/views.py @@ -73,13 +73,13 @@ ) from wger.exercises.views.helper import StreamVerbs from wger.utils.constants import ( + ENGLISH_SHORT_NAME, HTML_ATTRIBUTES_WHITELIST, HTML_STYLES_WHITELIST, HTML_TAG_WHITELIST, ) from wger.utils.language import load_language - logger = logging.getLogger(__name__) @@ -90,7 +90,7 @@ class ExerciseBaseViewSet(ModelViewSet): """ queryset = ExerciseBase.objects.all() serializer_class = ExerciseBaseSerializer - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) ordering_fields = '__all__' filterset_fields = ( 'category', @@ -127,7 +127,7 @@ class ExerciseTranslationViewSet(ModelViewSet): API endpoint for editing or adding exercise objects. """ queryset = Exercise.objects.all() - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) serializer_class = ExerciseTranslationSerializer ordering_fields = '__all__' filterset_fields = ( @@ -195,7 +195,7 @@ class ExerciseViewSet(viewsets.ReadOnlyModelViewSet): the information of an exercise, see /api/v2/exerciseinfo/ """ queryset = Exercise.objects.all() - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) serializer_class = ExerciseSerializer ordering_fields = '__all__' filterset_fields = ( @@ -264,41 +264,41 @@ def search(request): This format is currently used by the exercise search autocompleter """ q = request.GET.get('term', None) - language_code = request.GET.get('language', None) + language_codes = request.GET.get('language', ENGLISH_SHORT_NAME) response = {} results = [] if not q: return Response(response) - language = load_language(language_code) - exercises = Exercise.objects \ + languages = [load_language(l) for l in language_codes.split(',')] + translations = Exercise.objects \ .filter(Q(name__icontains=q) | Q(alias__alias__icontains=q)) \ - .filter(language=language) \ + .filter(language__in=languages) \ .order_by('exercise_base__category__name', 'name') \ .distinct() - for exercise in exercises: + for translation in translations: image = None thumbnail = None - if exercise.main_image: - image_obj = exercise.main_image + if translation.main_image: + image_obj = translation.main_image image = image_obj.image.url t = get_thumbnailer(image_obj.image) thumbnail = t.get_thumbnail(aliases.get('micro_cropped')).url - exercise_json = { - 'value': exercise.name, + result_json = { + 'value': translation.name, 'data': { - 'id': exercise.id, - 'base_id': exercise.exercise_base_id, - 'name': exercise.name, - 'category': _(exercise.category.name), + 'id': translation.id, + 'base_id': translation.exercise_base_id, + 'name': translation.name, + 'category': _(translation.category.name), 'image': image, 'image_thumbnail': thumbnail } } - results.append(exercise_json) + results.append(result_json) response['suggestions'] = results return Response(response) @@ -358,7 +358,7 @@ class EquipmentViewSet(viewsets.ReadOnlyModelViewSet): queryset = Equipment.objects.all() serializer_class = EquipmentSerializer ordering_fields = '__all__' - filterset_fields = ('name', ) + filterset_fields = ('name',) @method_decorator(cache_page(settings.WGER_SETTINGS['EXERCISE_CACHE_TTL'])) def dispatch(self, request, *args, **kwargs): @@ -372,7 +372,7 @@ class DeletionLogViewSet(viewsets.ReadOnlyModelViewSet): queryset = DeletionLog.objects.all() serializer_class = DeletionLogSerializer ordering_fields = '__all__' - filterset_fields = ('model_type', ) + filterset_fields = ('model_type',) class ExerciseCategoryViewSet(viewsets.ReadOnlyModelViewSet): @@ -382,7 +382,7 @@ class ExerciseCategoryViewSet(viewsets.ReadOnlyModelViewSet): queryset = ExerciseCategory.objects.all() serializer_class = ExerciseCategorySerializer ordering_fields = '__all__' - filterset_fields = ('name', ) + filterset_fields = ('name',) @method_decorator(cache_page(settings.WGER_SETTINGS['EXERCISE_CACHE_TTL'])) def dispatch(self, request, *args, **kwargs): @@ -396,7 +396,7 @@ class ExerciseImageViewSet(ModelViewSet): queryset = ExerciseImage.objects.all() serializer_class = ExerciseImageSerializer - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) ordering_fields = '__all__' filterset_fields = ( 'is_main', @@ -458,7 +458,7 @@ class ExerciseVideoViewSet(ModelViewSet): """ queryset = ExerciseVideo.objects.all() serializer_class = ExerciseVideoSerializer - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) ordering_fields = '__all__' filterset_fields = ( 'is_main', @@ -495,7 +495,7 @@ class ExerciseCommentViewSet(ModelViewSet): API endpoint for exercise comment objects """ serializer_class = ExerciseCommentSerializer - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) ordering_fields = '__all__' filterset_fields = ('comment', 'exercise') @@ -537,7 +537,7 @@ class ExerciseAliasViewSet(ModelViewSet): """ serializer_class = ExerciseAliasSerializer queryset = Alias.objects.all() - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) ordering_fields = '__all__' filterset_fields = ('alias', 'exercise') @@ -570,7 +570,7 @@ class ExerciseVariationViewSet(ModelViewSet): """ serializer_class = ExerciseVariationSerializer queryset = Variation.objects.all() - permission_classes = (CanContributeExercises, ) + permission_classes = (CanContributeExercises,) class MuscleViewSet(viewsets.ReadOnlyModelViewSet): diff --git a/wger/exercises/fixtures/test-exercises.json b/wger/exercises/fixtures/test-exercises.json index 3e3f988b2..9a3200ccc 100644 --- a/wger/exercises/fixtures/test-exercises.json +++ b/wger/exercises/fixtures/test-exercises.json @@ -225,7 +225,7 @@ "language": 1, "exercise_base": 4, "description": "", - "name": "Needed for demo user", + "name": "Weitere Testübung", "creation_date": "2022-01-10", "update_date": "2022-02-02T06:45:11+01:00" } diff --git a/wger/exercises/tests/test_search_api.py b/wger/exercises/tests/test_search_api.py new file mode 100644 index 000000000..87214c264 --- /dev/null +++ b/wger/exercises/tests/test_search_api.py @@ -0,0 +1,92 @@ +# This file is part of wger Workout Manager. +# +# wger Workout Manager is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# wger Workout Manager is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Workout Manager. If not, see . + +# Third Party +from rest_framework import status + +# wger +from wger.core.tests.api_base_test import ApiBaseTestCase +from wger.core.tests.base_testcase import BaseTestCase + + +class SearchExerciseApiTestCase(BaseTestCase, ApiBaseTestCase): + url = '/api/v2/exercise/search/' + + def test_basic_search_logged_out(self): + """ + Logged-out users are also allowed to use the search + """ + response = self.client.get(self.url + '?term=exercise') + result1 = response.data['suggestions'][0] + + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.data['suggestions']), 1) + self.assertEqual(result1['value'], 'Very cool exercise') + self.assertEqual(result1['data']['id'], 2) + + def test_basic_search_logged_in(self): + """ + Logged-in users get the same results + """ + self.authenticate('test') + response = self.client.get(self.url + '?term=exercise') + result1 = response.data['suggestions'][0] + + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.data['suggestions']), 1) + self.assertEqual(result1['value'], 'Very cool exercise') + self.assertEqual(result1['data']['id'], 2) + + def test_search_language_code_en(self): + """ + Explicitly passing the en language code (same as no code) + """ + response = self.client.get(self.url + '?term=exercise&language=en') + result1 = response.data['suggestions'][0] + + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.data['suggestions']), 1) + self.assertEqual(result1['value'], 'Very cool exercise') + self.assertEqual(result1['data']['id'], 2) + + def test_search_language_code_en_no_results(self): + """ + The "Testübung" exercise should not be found when searching in English + """ + response = self.client.get(self.url + '?term=Testübung&language=en') + + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.data['suggestions']), 0) + + def test_search_language_code_de(self): + """ + The "Testübung" exercise should be only found when searching in German + """ + response = self.client.get(self.url + '?term=Testübung&language=de') + result1 = response.data['suggestions'][0] + + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.data['suggestions']), 1) + self.assertEqual(result1['value'], 'Weitere Testübung') + self.assertEqual(result1['data']['id'], 7) + + def test_search_several_language_codes(self): + """ + Passing different language codes works correctly + """ + response = self.client.get(self.url + '?term=demo&language=en,de') + + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.data['suggestions']), 4) diff --git a/wger/utils/language.py b/wger/utils/language.py index 95ea4f19b..a0fa264b5 100644 --- a/wger/utils/language.py +++ b/wger/utils/language.py @@ -24,7 +24,6 @@ from wger.utils.cache import cache_mapper from wger.utils.constants import ENGLISH_SHORT_NAME - logger = logging.getLogger(__name__) @@ -34,10 +33,9 @@ def load_language(language_code=None): """ # Read the first part of a composite language, e.g. 'de-at' - if language_code is None: - used_language = translation.get_language().split('-')[0] - else: - used_language = language_code + used_language = translation.get_language().split('-')[0] \ + if language_code is None \ + else language_code language = cache.get(cache_mapper.get_language_key(used_language)) if language: From de8cb9c86b8fd768106c1980161dc6f0f952259b Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sun, 19 Feb 2023 20:49:35 +0100 Subject: [PATCH 2/3] Start working on support for country specific locales See #130 --- wger/core/models/language.py | 2 +- .../icons/{flag-ar.svg => flags/ar.svg} | 0 .../icons/{flag-az.svg => flags/az.svg} | 0 .../icons/{flag-bg.svg => flags/bg.svg} | 0 .../icons/{flag-ca.svg => flags/ca.svg} | 0 .../icons/{flag-cs.svg => flags/cs.svg} | 0 .../icons/{flag-de.svg => flags/de.svg} | 0 .../icons/{flag-el.svg => flags/el.svg} | 0 wger/core/static/images/icons/flags/en-au.svg | 24 +++++++ .../icons/{flag-en.svg => flags/en-gb.svg} | 0 wger/core/static/images/icons/flags/en.svg | 26 +++++++ .../icons/{flag-eo.svg => flags/eo.svg} | 0 wger/core/static/images/icons/flags/es-ar.svg | 34 ++++++++++ wger/core/static/images/icons/flags/es-co.svg | 1 + wger/core/static/images/icons/flags/es-mx.svg | 1 + wger/core/static/images/icons/flags/es-ni.svg | 1 + wger/core/static/images/icons/flags/es-ve.svg | 29 ++++++++ .../icons/{flag-es.svg => flags/es.svg} | 0 .../icons/{flag-fa.svg => flags/fa.svg} | 0 .../icons/{flag-fr.svg => flags/fr.svg} | 0 .../icons/{flag-he.svg => flags/he.svg} | 0 .../icons/{flag-hr.svg => flags/hr.svg} | 0 .../icons/{flag-id.svg => flags/id.svg} | 0 .../icons/{flag-it.svg => flags/it.svg} | 0 .../icons/{flag-nl.svg => flags/nl.svg} | 0 .../icons/{flag-no.svg => flags/no.svg} | 0 .../icons/{flag-pl.svg => flags/pl.svg} | 0 .../icons/{flag-pt.svg => flags/pt-br.svg} | 0 wger/core/static/images/icons/flags/pt.svg | 67 +++++++++++++++++++ .../icons/{flag-ru.svg => flags/ru.svg} | 0 .../icons/{flag-sv.svg => flags/sv.svg} | 0 .../icons/{flag-tr.svg => flags/tr.svg} | 0 .../icons/{flag-uk.svg => flags/uk.svg} | 0 .../icons/{flag-zh.svg => flags/zh.svg} | 0 wger/core/templates/tags/language_select.html | 5 +- wger/core/templates/template.html | 8 +-- wger/core/templatetags/wger_extras.py | 3 +- wger/settings_global.py | 61 +++++++++-------- wger/software/views.py | 1 - wger/utils/context_processor.py | 12 ++-- 40 files changed, 231 insertions(+), 44 deletions(-) rename wger/core/static/images/icons/{flag-ar.svg => flags/ar.svg} (100%) rename wger/core/static/images/icons/{flag-az.svg => flags/az.svg} (100%) rename wger/core/static/images/icons/{flag-bg.svg => flags/bg.svg} (100%) rename wger/core/static/images/icons/{flag-ca.svg => flags/ca.svg} (100%) rename wger/core/static/images/icons/{flag-cs.svg => flags/cs.svg} (100%) rename wger/core/static/images/icons/{flag-de.svg => flags/de.svg} (100%) rename wger/core/static/images/icons/{flag-el.svg => flags/el.svg} (100%) create mode 100644 wger/core/static/images/icons/flags/en-au.svg rename wger/core/static/images/icons/{flag-en.svg => flags/en-gb.svg} (100%) create mode 100644 wger/core/static/images/icons/flags/en.svg rename wger/core/static/images/icons/{flag-eo.svg => flags/eo.svg} (100%) create mode 100644 wger/core/static/images/icons/flags/es-ar.svg create mode 100644 wger/core/static/images/icons/flags/es-co.svg create mode 100644 wger/core/static/images/icons/flags/es-mx.svg create mode 100644 wger/core/static/images/icons/flags/es-ni.svg create mode 100644 wger/core/static/images/icons/flags/es-ve.svg rename wger/core/static/images/icons/{flag-es.svg => flags/es.svg} (100%) rename wger/core/static/images/icons/{flag-fa.svg => flags/fa.svg} (100%) rename wger/core/static/images/icons/{flag-fr.svg => flags/fr.svg} (100%) rename wger/core/static/images/icons/{flag-he.svg => flags/he.svg} (100%) rename wger/core/static/images/icons/{flag-hr.svg => flags/hr.svg} (100%) rename wger/core/static/images/icons/{flag-id.svg => flags/id.svg} (100%) rename wger/core/static/images/icons/{flag-it.svg => flags/it.svg} (100%) rename wger/core/static/images/icons/{flag-nl.svg => flags/nl.svg} (100%) rename wger/core/static/images/icons/{flag-no.svg => flags/no.svg} (100%) rename wger/core/static/images/icons/{flag-pl.svg => flags/pl.svg} (100%) rename wger/core/static/images/icons/{flag-pt.svg => flags/pt-br.svg} (100%) create mode 100644 wger/core/static/images/icons/flags/pt.svg rename wger/core/static/images/icons/{flag-ru.svg => flags/ru.svg} (100%) rename wger/core/static/images/icons/{flag-sv.svg => flags/sv.svg} (100%) rename wger/core/static/images/icons/{flag-tr.svg => flags/tr.svg} (100%) rename wger/core/static/images/icons/{flag-uk.svg => flags/uk.svg} (100%) rename wger/core/static/images/icons/{flag-zh.svg => flags/zh.svg} (100%) diff --git a/wger/core/models/language.py b/wger/core/models/language.py index e8fb8ef76..1352a4f95 100644 --- a/wger/core/models/language.py +++ b/wger/core/models/language.py @@ -70,4 +70,4 @@ def get_owner_object(self): @property def static_path(self): - return f'images/icons/flag-{self.short_name}.svg' + return f'images/icons/flags/{self.short_name}.svg' diff --git a/wger/core/static/images/icons/flag-ar.svg b/wger/core/static/images/icons/flags/ar.svg similarity index 100% rename from wger/core/static/images/icons/flag-ar.svg rename to wger/core/static/images/icons/flags/ar.svg diff --git a/wger/core/static/images/icons/flag-az.svg b/wger/core/static/images/icons/flags/az.svg similarity index 100% rename from wger/core/static/images/icons/flag-az.svg rename to wger/core/static/images/icons/flags/az.svg diff --git a/wger/core/static/images/icons/flag-bg.svg b/wger/core/static/images/icons/flags/bg.svg similarity index 100% rename from wger/core/static/images/icons/flag-bg.svg rename to wger/core/static/images/icons/flags/bg.svg diff --git a/wger/core/static/images/icons/flag-ca.svg b/wger/core/static/images/icons/flags/ca.svg similarity index 100% rename from wger/core/static/images/icons/flag-ca.svg rename to wger/core/static/images/icons/flags/ca.svg diff --git a/wger/core/static/images/icons/flag-cs.svg b/wger/core/static/images/icons/flags/cs.svg similarity index 100% rename from wger/core/static/images/icons/flag-cs.svg rename to wger/core/static/images/icons/flags/cs.svg diff --git a/wger/core/static/images/icons/flag-de.svg b/wger/core/static/images/icons/flags/de.svg similarity index 100% rename from wger/core/static/images/icons/flag-de.svg rename to wger/core/static/images/icons/flags/de.svg diff --git a/wger/core/static/images/icons/flag-el.svg b/wger/core/static/images/icons/flags/el.svg similarity index 100% rename from wger/core/static/images/icons/flag-el.svg rename to wger/core/static/images/icons/flags/el.svg diff --git a/wger/core/static/images/icons/flags/en-au.svg b/wger/core/static/images/icons/flags/en-au.svg new file mode 100644 index 000000000..3d1060dce --- /dev/null +++ b/wger/core/static/images/icons/flags/en-au.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wger/core/static/images/icons/flag-en.svg b/wger/core/static/images/icons/flags/en-gb.svg similarity index 100% rename from wger/core/static/images/icons/flag-en.svg rename to wger/core/static/images/icons/flags/en-gb.svg diff --git a/wger/core/static/images/icons/flags/en.svg b/wger/core/static/images/icons/flags/en.svg new file mode 100644 index 000000000..c31e89594 --- /dev/null +++ b/wger/core/static/images/icons/flags/en.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wger/core/static/images/icons/flag-eo.svg b/wger/core/static/images/icons/flags/eo.svg similarity index 100% rename from wger/core/static/images/icons/flag-eo.svg rename to wger/core/static/images/icons/flags/eo.svg diff --git a/wger/core/static/images/icons/flags/es-ar.svg b/wger/core/static/images/icons/flags/es-ar.svg new file mode 100644 index 000000000..7a7e92b3f --- /dev/null +++ b/wger/core/static/images/icons/flags/es-ar.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wger/core/static/images/icons/flags/es-co.svg b/wger/core/static/images/icons/flags/es-co.svg new file mode 100644 index 000000000..a9d62d475 --- /dev/null +++ b/wger/core/static/images/icons/flags/es-co.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wger/core/static/images/icons/flags/es-mx.svg b/wger/core/static/images/icons/flags/es-mx.svg new file mode 100644 index 000000000..769ed901b --- /dev/null +++ b/wger/core/static/images/icons/flags/es-mx.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wger/core/static/images/icons/flags/es-ni.svg b/wger/core/static/images/icons/flags/es-ni.svg new file mode 100644 index 000000000..1caf892e4 --- /dev/null +++ b/wger/core/static/images/icons/flags/es-ni.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wger/core/static/images/icons/flags/es-ve.svg b/wger/core/static/images/icons/flags/es-ve.svg new file mode 100644 index 000000000..5047ddf18 --- /dev/null +++ b/wger/core/static/images/icons/flags/es-ve.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wger/core/static/images/icons/flag-es.svg b/wger/core/static/images/icons/flags/es.svg similarity index 100% rename from wger/core/static/images/icons/flag-es.svg rename to wger/core/static/images/icons/flags/es.svg diff --git a/wger/core/static/images/icons/flag-fa.svg b/wger/core/static/images/icons/flags/fa.svg similarity index 100% rename from wger/core/static/images/icons/flag-fa.svg rename to wger/core/static/images/icons/flags/fa.svg diff --git a/wger/core/static/images/icons/flag-fr.svg b/wger/core/static/images/icons/flags/fr.svg similarity index 100% rename from wger/core/static/images/icons/flag-fr.svg rename to wger/core/static/images/icons/flags/fr.svg diff --git a/wger/core/static/images/icons/flag-he.svg b/wger/core/static/images/icons/flags/he.svg similarity index 100% rename from wger/core/static/images/icons/flag-he.svg rename to wger/core/static/images/icons/flags/he.svg diff --git a/wger/core/static/images/icons/flag-hr.svg b/wger/core/static/images/icons/flags/hr.svg similarity index 100% rename from wger/core/static/images/icons/flag-hr.svg rename to wger/core/static/images/icons/flags/hr.svg diff --git a/wger/core/static/images/icons/flag-id.svg b/wger/core/static/images/icons/flags/id.svg similarity index 100% rename from wger/core/static/images/icons/flag-id.svg rename to wger/core/static/images/icons/flags/id.svg diff --git a/wger/core/static/images/icons/flag-it.svg b/wger/core/static/images/icons/flags/it.svg similarity index 100% rename from wger/core/static/images/icons/flag-it.svg rename to wger/core/static/images/icons/flags/it.svg diff --git a/wger/core/static/images/icons/flag-nl.svg b/wger/core/static/images/icons/flags/nl.svg similarity index 100% rename from wger/core/static/images/icons/flag-nl.svg rename to wger/core/static/images/icons/flags/nl.svg diff --git a/wger/core/static/images/icons/flag-no.svg b/wger/core/static/images/icons/flags/no.svg similarity index 100% rename from wger/core/static/images/icons/flag-no.svg rename to wger/core/static/images/icons/flags/no.svg diff --git a/wger/core/static/images/icons/flag-pl.svg b/wger/core/static/images/icons/flags/pl.svg similarity index 100% rename from wger/core/static/images/icons/flag-pl.svg rename to wger/core/static/images/icons/flags/pl.svg diff --git a/wger/core/static/images/icons/flag-pt.svg b/wger/core/static/images/icons/flags/pt-br.svg similarity index 100% rename from wger/core/static/images/icons/flag-pt.svg rename to wger/core/static/images/icons/flags/pt-br.svg diff --git a/wger/core/static/images/icons/flags/pt.svg b/wger/core/static/images/icons/flags/pt.svg new file mode 100644 index 000000000..d3dc17e70 --- /dev/null +++ b/wger/core/static/images/icons/flags/pt.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wger/core/static/images/icons/flag-ru.svg b/wger/core/static/images/icons/flags/ru.svg similarity index 100% rename from wger/core/static/images/icons/flag-ru.svg rename to wger/core/static/images/icons/flags/ru.svg diff --git a/wger/core/static/images/icons/flag-sv.svg b/wger/core/static/images/icons/flags/sv.svg similarity index 100% rename from wger/core/static/images/icons/flag-sv.svg rename to wger/core/static/images/icons/flags/sv.svg diff --git a/wger/core/static/images/icons/flag-tr.svg b/wger/core/static/images/icons/flags/tr.svg similarity index 100% rename from wger/core/static/images/icons/flag-tr.svg rename to wger/core/static/images/icons/flags/tr.svg diff --git a/wger/core/static/images/icons/flag-uk.svg b/wger/core/static/images/icons/flags/uk.svg similarity index 100% rename from wger/core/static/images/icons/flag-uk.svg rename to wger/core/static/images/icons/flags/uk.svg diff --git a/wger/core/static/images/icons/flag-zh.svg b/wger/core/static/images/icons/flags/zh.svg similarity index 100% rename from wger/core/static/images/icons/flag-zh.svg rename to wger/core/static/images/icons/flags/zh.svg diff --git a/wger/core/templates/tags/language_select.html b/wger/core/templates/tags/language_select.html index 8459c6952..207d3b4e4 100644 --- a/wger/core/templates/tags/language_select.html +++ b/wger/core/templates/tags/language_select.html @@ -1,9 +1,8 @@ {% load i18n static %} - + {% translate language_name %} {% translate language_name %} / {{ language_name }} diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html index e02c9c564..0496443f3 100644 --- a/wger/core/templates/template.html +++ b/wger/core/templates/template.html @@ -194,10 +194,9 @@ class="btn btn-link text-muted small dropdown-toggle btn-sm" data-toggle="dropdown"> {% translate language.full_name %} + title="{% translate language.full_name %}"> {{ language.full_name }}