Merge branch 'master' into feature/ingredient-images

# Conflicts:
#	wger/nutrition/api/views.py
#	wger/settings_global.py
This commit is contained in:
Roland Geider
2022-11-30 15:18:06 +01:00
100 changed files with 22666 additions and 28795 deletions

View File

@@ -16,23 +16,15 @@ jobs:
strategy:
matrix:
#TODO: pypy3 has problems compiling lxml
python-version: [ '3.9', '3.10']
python-version: [ '3.9', '3.10' ]
name: CI job (python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3.0.11
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
- name: Display Python version

View File

@@ -7,8 +7,11 @@ on:
jobs:
apache:
name: Build apache image
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ 'amd64', 'arm64' ]
name: Build apache image (linux/${{ matrix.arch }})
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -31,12 +34,15 @@ jobs:
context: .
push: true
file: extras/docker/demo/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/${{ matrix.arch }}
tags: wger/demo:latest,wger/demo:2.2-dev,wger/apache:latest,wger/apache:2.2-dev
prod:
name: Build production image
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ 'amd64', 'arm64' ]
name: Build production image (linux/${{ matrix.arch }})
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -59,5 +65,5 @@ jobs:
context: .
push: true
file: extras/docker/development/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/${{ matrix.arch }}
tags: wger/server:latest,wger/server:2.2-dev,wger/devel:latest,wger/devel:2.2-dev

View File

@@ -70,6 +70,10 @@ Developers
* Kade - https://github.com/kp5431/
* Tom Bowyer - https://github.com/ImTheTom
* Rohan Karan - https://github.com/RohanKaran
* Mohammad Rafigh - https://github.com/mohammadrafigh
* Bernardo Koen - https://github.com/BernardoKoen
* Gabriel Liss - https://github.com/gabeliss
* Alexandra Rhodes - https://github.com/arhodes130
Translators
-----------

View File

@@ -36,7 +36,7 @@ RUN pip3 wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements_de
########
# Final
########
FROM wger/base:2.1-dev
FROM wger/base:2.2-dev
LABEL maintainer="Roland Geider <roland@geider.net>"
ARG DOCKER_DIR=./extras/docker/demo

View File

@@ -94,6 +94,7 @@ DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
WGER_SETTINGS["ALLOW_REGISTRATION"] = env.bool("ALLOW_REGISTRATION", True)
WGER_SETTINGS["ALLOW_GUEST_USERS"] = env.bool("ALLOW_GUEST_USERS", True)
WGER_SETTINGS["ALLOW_UPLOAD_VIDEOS"] = env.bool("ALLOW_UPLOAD_VIDEOS", True)
WGER_SETTINGS["MIN_ACCOUNT_AGE_TO_TRUST"] = env.int("MIN_ACCOUNT_AGE_TO_TRUST", 21) # in days
WGER_SETTINGS["EXERCISE_CACHE_TTL"] = env.int("EXERCISE_CACHE_TTL", 3600)
WGER_SETTINGS["USE_CELERY"] = env.bool("USE_CELERY", False)

View File

@@ -88,7 +88,6 @@ filter_dump(('core.repetitionunit',), 'repetition_units.json')
#
# Configurations
#
filter_dump(('config.languageconfig',), 'language_config.json')
filter_dump(('config.gymconfig',), 'gym_config.json')
#

View File

@@ -9,16 +9,16 @@ django-formtools~=2.4
django-recaptcha~=3.0.0
Django~=3.2
django-activity-stream~=1.4
django-axes==5.39.0
django-axes==5.40.1
django-crispy-forms~=1.14
django-simple-history~=3.1
django-simple-history~=3.2
django-email-verification~=0.3.1
django_compressor~=4.1
django_extensions~=3.2
django-storages~=1.13
django-environ==0.9.0
easy-thumbnails==2.8.3
fontawesomefree~=6.2.0
fontawesomefree~=6.2.1
icalendar==4.1.0
invoke==1.7.3
pillow==9.3.0

View File

@@ -6,10 +6,10 @@
-r requirements.txt
# Building/installing
wheel==0.37.1
wheel==0.38.4
# for ingredient import script from OFF
pymongo==4.3.2
pymongo==4.3.3
# Development packages
coverage==6.5.0

File diff suppressed because it is too large Load Diff

View File

@@ -22,85 +22,5 @@
"full_name": "Français",
"short_name": "fr"
}
},
{
"pk": 1,
"model": "config.languageconfig",
"fields": {
"language_target": 1,
"show": true,
"language": 1,
"item": "1"
}
},
{
"pk": 2,
"model": "config.languageconfig",
"fields": {
"language_target": 1,
"show": true,
"language": 1,
"item": "2"
}
},
{
"pk": 3,
"model": "config.languageconfig",
"fields": {
"language_target": 2,
"show": false,
"language": 1,
"item": "1"
}
},
{
"pk": 4,
"model": "config.languageconfig",
"fields": {
"language_target": 2,
"show": false,
"language": 1,
"item": "2"
}
},
{
"pk": 5,
"model": "config.languageconfig",
"fields": {
"language_target": 1,
"show": false,
"language": 2,
"item": "1"
}
},
{
"pk": 6,
"model": "config.languageconfig",
"fields": {
"language_target": 1,
"show": false,
"language": 2,
"item": "2"
}
},
{
"pk": 7,
"model": "config.languageconfig",
"fields": {
"language_target": 2,
"show": true,
"language": 2,
"item": "1"
}
},
{
"pk": 8,
"model": "config.languageconfig",
"fields": {
"language_target": 2,
"show": true,
"language": 2,
"item": "2"
}
}
]

View File

@@ -16,4 +16,3 @@
# Local
from .gym_config import GymConfig
from .language_config import LanguageConfig

View File

@@ -1,93 +0,0 @@
# This file is part of wger Workout Manager <https://github.com/wger-project>.
# Copyright (C) 2013 - 2021 wger Team
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Standard Library
# Django
from django.core.cache import cache
from django.db import models
from django.utils.translation import gettext_lazy as _
# wger
from wger.core.models import Language
from wger.utils.cache import (
cache_mapper,
delete_template_fragment_cache,
)
class LanguageConfig(models.Model):
"""
Configuration for languages
Allows to specify what exercises and ingredients are shown for each language
"""
SHOW_ITEM_EXERCISES = '1'
SHOW_ITEM_INGREDIENTS = '2'
SHOW_ITEM_LIST = (
(SHOW_ITEM_EXERCISES, _('Exercises')),
(SHOW_ITEM_INGREDIENTS, _('Ingredients')),
)
language = models.ForeignKey(
Language,
related_name='language_source',
editable=False,
on_delete=models.CASCADE,
)
language_target = models.ForeignKey(
Language,
related_name='language_target',
editable=False,
on_delete=models.CASCADE,
)
item = models.CharField(max_length=2, choices=SHOW_ITEM_LIST, editable=False)
show = models.BooleanField(default=1)
class Meta:
"""
Set some other properties
"""
ordering = [
"item",
"language_target",
]
def __str__(self):
"""
Return a more human-readable representation
"""
return "Config for language {0}".format(self.language)
def save(self, *args, **kwargs):
"""
Reset all cached infos
"""
super(LanguageConfig, self).save(*args, **kwargs)
# Cached objects
cache.delete(cache_mapper.get_language_config_key(self.language, self.item))
def delete(self, *args, **kwargs):
"""
Reset all cached infos
"""
# Cached objects
cache.delete(cache_mapper.get_language_config_key(self.language, self.item))
super(LanguageConfig, self).delete(*args, **kwargs)

View File

@@ -13,35 +13,3 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# Django
from django.db.models.signals import post_save
from django.dispatch import receiver
# wger
from wger.config.models import LanguageConfig
from wger.core.models import Language
@receiver(post_save, sender=Language)
def init_language_config(sender, instance, created, **kwargs):
"""
Creates language config entries when new languages are created
(all combinations of all languages)
"""
for language_source in Language.objects.all():
for language_target in Language.objects.all():
if not LanguageConfig.objects.filter(language=language_source)\
.filter(language_target=language_target)\
.exists():
for item in LanguageConfig.SHOW_ITEM_LIST:
config = LanguageConfig()
config.language = language_source
config.language_target = language_target
config.item = item[0]
if language_source == language_target:
config.show = True
else:
config.show = False
config.save()

View File

@@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# 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 <http://www.gnu.org/licenses/>.
# wger
from wger.config.models import LanguageConfig
from wger.core.tests.base_testcase import WgerEditTestCase
class EditLanguageConfigTestCase(WgerEditTestCase):
"""
Tests editing a language config
"""
object_class = LanguageConfig
url = 'config:language_config:edit'
pk = 1
data = {'show': False}

View File

@@ -20,17 +20,9 @@ from django.conf.urls import include
from django.urls import path
# wger
from wger.config.views import (
gym_config,
language_config,
)
from wger.config.views import gym_config
# sub patterns for language configs
patterns_language_config = [
path('<int:pk>/edit', language_config.LanguageConfigUpdateView.as_view(), name='edit'),
]
# sub patterns for default gym
patterns_gym_config = [
path('edit', gym_config.GymConfigUpdateView.as_view(), name='edit'),
@@ -40,10 +32,6 @@ patterns_gym_config = [
# Actual patterns
#
urlpatterns = [
path(
'language-config/',
include((patterns_language_config, 'language_config'), namespace="language_config")
),
path(
'gym-config/',
include((patterns_gym_config, 'gym_config'), namespace="gym_config"),

View File

@@ -1,55 +0,0 @@
# -*- coding: utf-8 -*-
# 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
# Standard Library
import logging
# Django
from django.contrib.auth.mixins import (
LoginRequiredMixin,
PermissionRequiredMixin,
)
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy
from django.views.generic import UpdateView
# wger
from wger.config.models import LanguageConfig
from wger.utils.generic_views import WgerFormMixin
logger = logging.getLogger(__name__)
class LanguageConfigUpdateView(
WgerFormMixin,
LoginRequiredMixin,
PermissionRequiredMixin,
UpdateView,
):
"""
Generic view to edit a language config
"""
model = LanguageConfig
fields = ['show']
permission_required = 'config.change_languageconfig'
title = gettext_lazy('Edit')
def get_success_url(self):
"""
Return to the language page
"""
return reverse_lazy('core:language:view', kwargs={'pk': self.object.language_id})

View File

@@ -18,21 +18,6 @@
"config",
"gymconfig"
],
[
"add_languageconfig",
"config",
"languageconfig"
],
[
"change_languageconfig",
"config",
"languageconfig"
],
[
"delete_languageconfig",
"config",
"languageconfig"
],
[
"add_language",
"core",

View File

@@ -20,7 +20,7 @@
"pk": 3,
"fields": {
"short_name": "bg",
"full_name": "\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438 \u0435\u0437\u0438\u043a"
"full_name": "\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438 \u0435\u0437\u0438\u043a"
}
},
{
@@ -68,7 +68,7 @@
"pk": 9,
"fields": {
"short_name": "cs",
"full_name": "\u010de\u0161tina"
"full_name": "\u010ce\u0161tina"
}
},
{
@@ -116,7 +116,7 @@
"pk": 15,
"fields": {
"short_name": "uk",
"full_name": "\u0443\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430 \u043c\u043e\u0432\u0430"
"full_name": "\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430 \u043c\u043e\u0432\u0430"
}
},
{
@@ -126,5 +126,21 @@
"short_name": "tr",
"full_name": "T\u00fcrk\u00e7e"
}
},
{
"model": "core.language",
"pk": 17,
"fields": {
"short_name": "zh",
"full_name": "\u6c49\u8bed"
}
},
{
"model": "core.language",
"pk": 18,
"fields": {
"short_name": "ca",
"full_name": "Catala"
}
}
]
]

View File

@@ -19,6 +19,7 @@ from datetime import date
# Django
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import (
AuthenticationForm,
UserCreationForm,
@@ -71,6 +72,28 @@ class UserLoginForm(AuthenticationForm):
)
)
def clean(self):
"""
Note this clean method is the same as the one from django/contrib/auth/forms.py,
but we pass the request as an explicit request parameter. Otherwise, django
axes won't work
See https://github.com/wger-project/wger/issues/1163
"""
username = self.cleaned_data.get("username")
password = self.cleaned_data.get("password")
if username is not None and password:
self.user_cache = authenticate(
request=self.request, username=username, password=password
)
if self.user_cache is None:
raise self.get_invalid_login_error()
else:
self.confirm_login_allowed(self.user_cache)
return self.cleaned_data
class UserPreferencesForm(forms.ModelForm):
first_name = forms.CharField(label=_('First name'), required=False)

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.2.16 on 2022-11-10 14:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0014_merge_20210818_1735'),
]
operations = [
migrations.AlterField(
model_name='language',
name='short_name',
field=models.CharField(max_length=2, unique=True, verbose_name='Language short name'),
),
]

View File

@@ -26,7 +26,11 @@ class Language(models.Model):
"""
# e.g. 'de'
short_name = models.CharField(max_length=2, verbose_name=_('Language short name'))
short_name = models.CharField(
max_length=2,
verbose_name=_('Language short name'),
unique=True,
)
# e.g. 'Deutsch'
full_name = models.CharField(max_length=30, verbose_name=_('Language full name'))

View File

@@ -19,6 +19,7 @@ import datetime
import decimal
# Django
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import (
@@ -32,7 +33,10 @@ from django.utils.translation import gettext_lazy as _
# wger
from wger.gym.models import Gym
from wger.utils.constants import TWOPLACES
from wger.utils.units import AbstractWeight
from wger.utils.units import (
AbstractHeight,
AbstractWeight,
)
from wger.weight.models import WeightEntry
# Local
@@ -201,7 +205,7 @@ by the US Department of Agriculture. It is extremely complete, with around
return False
days_since_joined = datetime.date.today() - self.user.date_joined.date()
minimum_account_age = 21
minimum_account_age = settings.WGER_SETTINGS['MIN_ACCOUNT_AGE_TO_TRUST']
return days_since_joined.days > minimum_account_age and self.email_verified
@@ -446,7 +450,8 @@ by the US Department of Agriculture. It is extremely complete, with around
return 0
weight = self.weight if self.use_metric else AbstractWeight(self.weight, 'lb').kg
return weight / pow(self.height / decimal.Decimal(100), 2)
height = self.height if self.use_metric else AbstractHeight(self.height, 'inches').inches
return weight / pow(height / decimal.Decimal(100), 2)
def calculate_basal_metabolic_rate(self, formula=1):
"""

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="810" height="540">
<rect width="810" height="540" fill="#FCDD09"/>
<path stroke="#DA121A" stroke-width="60" d="M0,90H810m0,120H0m0,120H810m0,120H0"/>
</svg>

After

Width:  |  Height:  |  Size: 242 B

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="900" height="600" viewBox="0 0 30 20">
<defs>
<path id="s" d="M0,-1 0.587785,0.809017 -0.951057,-0.309017H0.951057L-0.587785,0.809017z" fill="#FFFF00"/>
</defs>
<rect width="30" height="20" fill="#EE1C25"/>
<use xlink:href="#s" transform="translate(5,5) scale(3)"/>
<use xlink:href="#s" transform="translate(10,2) rotate(23.036243)"/>
<use xlink:href="#s" transform="translate(12,4) rotate(45.869898)"/>
<use xlink:href="#s" transform="translate(12,7) rotate(69.945396)"/>
<use xlink:href="#s" transform="translate(10,9) rotate(20.659808)"/>
</svg>

After

Width:  |  Height:  |  Size: 677 B

View File

@@ -47,7 +47,8 @@
"missingExerciseDescription": "Hilf der Community und leiste einen Beitrag!",
"deleteExerciseFull": "Vollständige Übung löschen",
"deleteTranslation": "Übersetzung löschen",
"deleteExerciseBody": "Möchtest due die Übung \"{{name}}\" löschen? Du kannst entweder die aktuelle {{language}} Übersetzung oder die komplette Übung mit allen Übersetzungen, Bildern usw. löschen."
"deleteExerciseBody": "Möchtest due die Übung \"{{name}}\" löschen? Du kannst entweder die aktuelle {{language}} Übersetzung oder die komplette Übung mit allen Übersetzungen, Bildern usw. löschen.",
"basics": "Grundlagen"
},
"noResults": "Keine Ergebnisse",
"noResultsDescription": "Keine Ergebnisse für diese Suche gefunden, bitte reduziere die Anzahl der Filter.",

View File

@@ -1,107 +1,107 @@
{
"weight": "Weight",
"date": "Date",
"submit": "Submit",
"edit": "Edit",
"delete": "Delete",
"add": "Add",
"difference": "Difference",
"days": "Days",
"loading": "Loading...",
"nutritionalPlan": "Nutritional plan",
"addEntry": "Add entry",
"currentWeight": "Current weight",
"workout": "Workout",
"exercises": {
"contributeExercise": "Contribute an exercise",
"step1HeaderBasics": "Basics in English",
"variations": "Variations",
"notEnoughRightsHeader": "You can't contribute exercises",
"notEnoughRights": "You can only contribute exercises if your account is older than {{days}} days and have verified your email",
"muscles": "Muscles",
"secondaryMuscles": "Secondary muscles",
"whatVariationsExist": "Which variations of this exercise exist, if any?",
"filterVariations": "Enter exercise name to filter variations",
"identicalExercisePleaseDiscard": "If you notice an exercise that is identical to the one you're adding, please discard your draft and edit that exercise instead.",
"translateExerciseNow": "Translate this exercise now",
"compatibleImagesCC": "Images must be compatible with the CC BY SA license. If in doubt, upload only photos you've taken yourself.",
"alternativeNames": "Alternative names",
"notes": "Notes",
"equipment": "Equipment",
"checkInformationBeforeSubmitting": "Please check that the information you entered is correct before submitting the exercise",
"submitExercise": "Submit exercise",
"successfullyUpdated": "The exercise was successfully updated. Due to caching it might take some time till the changes are visible throughout the application.",
"weight": "Weight",
"date": "Date",
"submit": "Submit",
"edit": "Edit",
"delete": "Delete",
"add": "Add",
"difference": "Difference",
"days": "Days",
"loading": "Loading...",
"nutritionalPlan": "Nutritional plan",
"addEntry": "Add entry",
"currentWeight": "Current weight",
"workout": "Workout",
"exercises": {
"contributeExercise": "Contribute an exercise",
"step1HeaderBasics": "Basics in English",
"variations": "Variations",
"notEnoughRightsHeader": "You can't contribute exercises",
"notEnoughRights": "You can only contribute exercises if your account is older than {{days}} days and have verified your email",
"muscles": "Muscles",
"secondaryMuscles": "Secondary muscles",
"whatVariationsExist": "Which variations of this exercise exist, if any?",
"filterVariations": "Enter exercise name to filter variations",
"identicalExercisePleaseDiscard": "If you notice an exercise that is identical to the one you're adding, please discard your draft and edit that exercise instead.",
"translateExerciseNow": "Translate this exercise now",
"compatibleImagesCC": "Images must be compatible with the CC BY SA license. If in doubt, upload only photos you've taken yourself.",
"alternativeNames": "Alternative names",
"notes": "Notes",
"equipment": "Equipment",
"checkInformationBeforeSubmitting": "Please check that the information you entered is correct before submitting the exercise",
"submitExercise": "Submit exercise",
"successfullyUpdated": "The exercise was successfully updated. Due to caching it might take some time till the changes are visible throughout the application.",
"description": "Description",
"basics": "Basics",
"exerciseNotTranslated": "No translation available",
"exerciseNotTranslatedBody": "This exercise is currently not available in the currently selected language. Do you want to contribute a translation?",
"alsoKnownAs": "Also known as:",
"primaryMuscles": "Primary muscles",
"deleteExerciseBody": "Do you want to delete the exercise \"{{name}}\"? You can either delete the current {{language}} translation or the complete exercise with all translations, images, etc.",
"deleteTranslation": "Delete translation",
"deleteExerciseFull": "Delete full exercise",
"exercises": "Exercises",
"changeExerciseLanguage": "Change this exercise's language",
"noEquipment": "No equipment",
"missingExercise": "Missing a certain exercise?",
"missingExerciseDescription": "Help out the community by contributing it!",
"searchExerciseName": "Search by exercise name",
"newNote": "New note",
"notesHelpText": "Notes are short comments on how to perform the exercise such as \"keep your body straight\""
},
"description": "Description",
"basics": "Basics",
"exerciseNotTranslated": "No translation available",
"exerciseNotTranslatedBody": "This exercise is currently not available in the currently selected language. Do you want to contribute a translation?",
"alsoKnownAs": "Also known as:",
"primaryMuscles": "Primary muscles",
"deleteExerciseBody": "Do you want to delete the exercise \"{{name}}\"? You can either delete the current {{language}} translation or the complete exercise with all translations, images, etc.",
"deleteTranslation": "Delete translation",
"deleteExerciseFull": "Delete full exercise",
"exercises": "Exercises",
"changeExerciseLanguage": "Change this exercise's language",
"noEquipment": "No equipment",
"missingExercise": "Missing a certain exercise?",
"missingExerciseDescription": "Help out the community by contributing it!",
"searchExerciseName": "Search by exercise name",
"newNote": "New note",
"notesHelpText": "Notes are short comments on how to perform the exercise such as \"keep your body straight\""
},
"description": "Description",
"translation": "Translation",
"images": "Images",
"overview": "Overview",
"preferences": "Preferences",
"continue": "Continue",
"goBack": "Back",
"language": "Language",
"forms": {
"supportedImageFormats": "Only JPEG, PNG and WEBP files below 20Mb are supported",
"valueTooShort": "The value is too short",
"valueTooLong": "The value is too long",
"fieldRequired": "This field is required"
},
"name": "Name",
"category": "Category",
"English": "English",
"save": "Save",
"videos": "Videos",
"cannotBeUndone": "This action can't be undone.",
"cancel": "Cancel",
"noResults": "No results",
"noResultsDescription": "No results found for this query, consider reducing the number of filters.",
"server": {
"abs": "Abs",
"arms": "Arms",
"back": "Back",
"calves": "Calves",
"chest": "Chest",
"legs": "Legs",
"shoulders": "Shoulders",
"barbell": "B",
"bench": "Bench",
"dumbbell": "Dumbbell",
"gym_mat": "Gym mat",
"incline_bench": "Incline bench",
"kettlebell": "Kettlebell",
"pull_up_bar": "Pull up bar",
"sz_bar": "SZ bar",
"swiss_ball": "Swiss ball",
"none__bodyweight_exercise_": "none (bodyweight exercise)",
"biceps": "Biceps",
"hamstrings": "Hamstrings",
"lower_back": "Lower back",
"glutes": "Glutes",
"lats": "Lats",
"quads": "Quads",
"triceps": "Triceps",
"kilometers": "Kilometers",
"miles": "Miles",
"minutes": "Minutes",
"repetitions": "Repetitions",
"seconds": "Seconds",
"until_failure": "Until failure"
}
"translation": "Translation",
"images": "Images",
"overview": "Overview",
"preferences": "Preferences",
"continue": "Continue",
"goBack": "Back",
"language": "Language",
"forms": {
"supportedImageFormats": "Only JPEG, PNG and WEBP files below 20Mb are supported",
"valueTooShort": "The value is too short",
"valueTooLong": "The value is too long",
"fieldRequired": "This field is required"
},
"name": "Name",
"category": "Category",
"English": "English",
"save": "Save",
"videos": "Videos",
"cannotBeUndone": "This action can't be undone.",
"cancel": "Cancel",
"noResults": "No results",
"noResultsDescription": "No results found for this query, consider reducing the number of filters.",
"server": {
"abs": "Abs",
"arms": "Arms",
"back": "Back",
"calves": "Calves",
"chest": "Chest",
"legs": "Legs",
"shoulders": "Shoulders",
"barbell": "Barbell",
"bench": "Bench",
"dumbbell": "Dumbbell",
"gym_mat": "Gym mat",
"incline_bench": "Incline bench",
"kettlebell": "Kettlebell",
"pull_up_bar": "Pull up bar",
"sz_bar": "SZ bar",
"swiss_ball": "Swiss ball",
"none__bodyweight_exercise_": "none (bodyweight exercise)",
"biceps": "Biceps",
"hamstrings": "Hamstrings",
"lower_back": "Lower back",
"glutes": "Glutes",
"lats": "Lats",
"quads": "Quads",
"triceps": "Triceps",
"kilometers": "Kilometers",
"miles": "Miles",
"minutes": "Minutes",
"repetitions": "Repetitions",
"seconds": "Seconds",
"until_failure": "Until failure"
}
}

View File

@@ -1,57 +1,57 @@
{
"difference": "Différence",
"delete": "Supprimer",
"date": "Date",
"days": "Jours",
"edit": "Modifier",
"weight": "Poids",
"submit": "Envoyer",
"add": "Ajouter",
"close": "Fermer",
"exercises": {
"secondaryMuscles": "Muscles secondaires",
"searchExerciseName": "Rechercher par nom d'exercice",
"alsoKnownAs": "Aussi connu sous :",
"notes": "Notes",
"description": "Description",
"noEquipment": "Sans équipement",
"missingExercise": "Un certain exercice manque ?",
"missingExerciseDescription": "Aidez la communauté en y contribuant !",
"contributeExercise": "Contribuer à un exercice",
"exercises": "Exercices",
"category": "Catégorie",
"equipment": "Equipement"
},
"server": {
"arms": "Bras",
"back": "Dos",
"calves": "Mollets",
"chest": "Pectoraux",
"legs": "Jambes",
"shoulders": "Epaules",
"bench": "Banc",
"barbell": "Barre",
"primaryMuscles": "Muscle primaire",
"pull-up_bar": "Barre de traction",
"swiss_ball": "Ballon de gym",
"kilometers": "Kilomètres",
"miles": "Miles",
"minutes": "Minutes",
"repetitions": "Répétitions",
"seconds": "Secondes",
"until_failure": "Jusqu'à l'échec",
"gym_mat": "Tapis de gymnastique",
"dumbbell": "Haltère",
"kettlebell": "Kettlebell",
"muscles": "Muscles",
"sz-bar": "Barre SZ",
"none_(bodyweight_exercise)": "Aucun (exercice au poids du corps)",
"incline_bench": "Banc incliné"
},
"noResults": "Aucun résultats",
"noResultsDescription": "Aucun résultats n'a été trouvé avec cette requête, essayez de réduire le nombre de filtres.",
"nutritionalPlan": "Plan nutritionnel",
"addEntry": "Ajouter une entrée",
"currentWeight": "Poids actuel",
"workout": "Séance"
"difference": "Différence",
"delete": "Supprimer",
"date": "Date",
"days": "Jours",
"edit": "Modifier",
"weight": "Poids",
"submit": "Envoyer",
"add": "Ajouter",
"close": "Fermer",
"exercises": {
"secondaryMuscles": "Muscles secondaires",
"searchExerciseName": "Rechercher par nom d'exercice",
"alsoKnownAs": "Aussi connu sous :",
"notes": "Notes",
"description": "Description",
"noEquipment": "Sans équipement",
"missingExercise": "Un certain exercice manque ?",
"missingExerciseDescription": "Aidez la communauté en y contribuant !",
"contributeExercise": "Contribuer à un exercice",
"exercises": "Exercices",
"category": "Catégorie",
"equipment": "Equipement"
},
"server": {
"arms": "Bras",
"back": "Dos",
"calves": "Mollets",
"chest": "Pectoraux",
"legs": "Jambes",
"shoulders": "Epaules",
"bench": "Banc",
"barbell": "Barre",
"primaryMuscles": "Muscle primaire",
"pull-up_bar": "Barre de traction",
"swiss_ball": "Ballon de gym",
"kilometers": "Kilomètres",
"miles": "Miles",
"minutes": "Minutes",
"repetitions": "Répétitions",
"seconds": "Secondes",
"until_failure": "Jusqu'à l'échec",
"gym_mat": "Tapis de gymnastique",
"dumbbell": "Haltère",
"kettlebell": "Kettlebell",
"muscles": "Muscles",
"sz-bar": "Barre SZ",
"none_(bodyweight_exercise)": "Aucun (exercice au poids du corps)",
"incline_bench": "Banc incliné"
},
"noResults": "Aucun résultats",
"noResultsDescription": "Aucun résultats n'a été trouvé avec cette requête, essayez de réduire le nombre de filtres.",
"nutritionalPlan": "Plan nutritionnel",
"addEntry": "Ajouter une entrée",
"currentWeight": "Poids actuel",
"workout": "Séance"
}

View File

@@ -1,56 +1,76 @@
{
"add": "Aggiungi",
"addEntry": "Aggiungi voce",
"currentWeight": "Peso attuale",
"date": "Data",
"days": "Giorni",
"delete": "Elimina",
"difference": "Differenza",
"edit": "Modifica",
"exercises": {
"alsoKnownAs": "Conosciuto anche come:",
"category": "Categoria",
"contributeExercise": "Suggerisci un esercizio",
"add": "Aggiungi",
"addEntry": "Aggiungi voce",
"currentWeight": "Peso attuale",
"date": "Data",
"days": "Giorni",
"delete": "Elimina",
"difference": "Differenza",
"edit": "Modifica",
"exercises": {
"alsoKnownAs": "Conosciuto anche come:",
"category": "Categoria",
"contributeExercise": "Suggerisci un esercizio",
"description": "Descrizione",
"equipment": "Attrezzatura",
"exercises": "Esercizi",
"missingExercise": "Ti manca un certo esercizio?",
"missingExerciseDescription": "Aiuta la comunità contribuendo!",
"muscles": "Muscoli",
"noEquipment": "Senza attrezzatura",
"notes": "Note",
"primaryMuscles": "Muscoli primari",
"searchExerciseName": "Cerca per nome dell'esercizio",
"secondaryMuscles": "Muscoli secondari",
"deleteTranslation": "Cancella traduzione",
"deleteExerciseFull": "Cancella tutto l'esercizio",
"exerciseNotTranslated": "Nessuna traduzione disponibile",
"notEnoughRightsHeader": "Non puoi contribuire agli esercizi",
"notEnoughRights": "Puoi contribuire agli esercizi solo se il tuo account è più vecchio di {{days}} giorni e hai verificato il tuo indirizzo mail",
"alternativeNames": "Nomi alternativi",
"changeExerciseLanguage": "Modifica la lingua dell'esercizio",
"filterVariations": "Inserisci il nome dell'esercizio per filtrare le variazioni",
"translateExerciseNow": "Traduci l'esercizio adesso",
"compatibleImagesCC": "Le immagini devono essere compatibili con la licenza CC BY SA. In caso di dubbi, inserisci una foto che hai fatto personalmente",
"submitExercise": "Invia esercizio",
"whatVariationsExist": "Quali variazioni esistono per l'esercizio?",
"variations": "Variazioni",
"identicalExercisePleaseDiscard": "Se l'esercizio è identico a quello che stai aggiungendo, per favore elimina la bozza e modifica l'esercizio già presente",
"checkInformationBeforeSubmitting": "Per favore controlla che le informazioni inserite siano corrette prima di confermare l'esercizio"
},
"noResults": "Nessun risultato",
"noResultsDescription": "Nessun risultato trovato. Prova a ridurre i termini di ricerca.",
"nutritionalPlan": "Piano nutrizionale",
"server": {
"arms": "Braccia",
"back": "Schiena",
"barbell": "Bilanciere",
"bench": "Panca",
"calves": "Polpacci",
"chest": "Petto",
"dumbbell": "Manubrio",
"gym_mat": "Materassino",
"incline_bench": "Panca inclinata",
"kettlebell": "Kettlebell",
"kilometers": "Kilometri",
"legs": "Gambe",
"miles": "Miglia",
"minutes": "Minuti",
"none_(bodyweight_exercise)": "nessuno (esercizio a corpo libero)",
"pull-up_bar": "Barra per trazioni",
"repetitions": "Ripetizioni",
"seconds": "Secondi",
"shoulders": "Spalle",
"swiss_ball": "Palla da ginnastica",
"sz-bar": "SZ bar",
"until_failure": "A sfinimento"
},
"submit": "Invia",
"weight": "Peso",
"workout": "Allenamento",
"description": "Descrizione",
"equipment": "Attrezzatura",
"exercises": "Esercizi",
"missingExercise": "Ti manca un certo esercizio?",
"missingExerciseDescription": "Aiuta la comunità contribuendo!",
"muscles": "Muscoli",
"noEquipment": "Senza attrezzatura",
"notes": "Note",
"primaryMuscles": "Muscoli primari",
"searchExerciseName": "Cerca per nome dell'esercizio",
"secondaryMuscles": "Muscoli secondari"
},
"noResults": "Nessun risultato",
"noResultsDescription": "Nessun risultato trovato. Prova a ridurre i termini di ricerca.",
"nutritionalPlan": "Piano nutrizionale",
"server": {
"arms": "Braccia",
"back": "Schiena",
"barbell": "Bilanciere",
"bench": "Panca",
"calves": "Polpacci",
"chest": "Petto",
"dumbbell": "Manubrio",
"gym_mat": "Materassino",
"incline_bench": "Panca inclinata",
"kettlebell": "Kettlebell",
"kilometers": "Kilometri",
"legs": "Gambe",
"miles": "Miglia",
"minutes": "Minuti",
"none_(bodyweight_exercise)": "nessuno (esercizio a corpo libero)",
"pull-up_bar": "Barra per trazioni",
"repetitions": "Ripetizioni",
"seconds": "Secondi",
"shoulders": "Spalle",
"swiss_ball": "Palla da ginnastica",
"sz-bar": "SZ bar",
"until_failure": "A sfinimento"
},
"submit": "Invia",
"weight": "Peso",
"workout": "Allenamento"
}
"save": "Salva",
"category": "Categoria",
"name": "Nome",
"loading": "Caricamento..."
}

View File

@@ -1,56 +1,111 @@
{
"add": "Dodaj",
"addEntry": "Dodaj wpis",
"currentWeight": "Aktualna waga",
"date": "Data",
"days": "Dni",
"delete": "Usuń",
"difference": "Różnice",
"edit": "Edytuj",
"exercises": {
"alsoKnownAs": "Inna nazwa ćwiczenia:",
"category": "Kategoria",
"contributeExercise": "Dołącz to ćwiczenie",
"add": "Dodaj",
"addEntry": "Dodaj wpis",
"currentWeight": "Aktualna waga",
"date": "Data",
"days": "Dni",
"delete": "Usuń",
"difference": "Różnice",
"edit": "Edytuj",
"exercises": {
"alsoKnownAs": "Inna nazwa ćwiczenia:",
"category": "Kategoria",
"contributeExercise": "Dołącz to ćwiczenie",
"description": "Opis",
"equipment": "Sprzęt",
"exercises": "Ćwiczenia",
"missingExercise": "Brakuje Ci określonego ćwiczenia ?",
"missingExerciseDescription": "Pomóż społeczności, dodając to !",
"muscles": "Mięśnie",
"noEquipment": "Bez sprzętu",
"notes": "Notatki",
"primaryMuscles": "Mięśnie główne",
"searchExerciseName": "Szukaj według nazw ćwiczeń",
"secondaryMuscles": "Mięśnie pomocnicze",
"basics": "Podstawa",
"notEnoughRightsHeader": "Nie możesz dodawać ćwiczeń",
"changeExerciseLanguage": "Zmień język tego ćwiczenia",
"notesHelpText": "Notatki to krótkie komentarze dotyczące wykonywania ćwiczenia, np. „utrzymuj swoje ciało prosto”",
"filterVariations": "Wpisz nazwę ćwiczenia aby filtrować wariację",
"variations": "Wariacje",
"whatVariationsExist": "Czy istnieją jakieś wariacje tego ćwiczenia?",
"identicalExercisePleaseDiscard": "Jeśli zauważysz ćwiczenie identyczne z tym które dodajesz, odrzuć swoją wersję i edytuj to ćwiczenie.",
"checkInformationBeforeSubmitting": "Przed przesłaniem ćwiczenia sprawdź czy wprowadzone informacje są prawidłowe",
"submitExercise": "Prześlij ćwiczenie",
"exerciseNotTranslated": "Brak dostępnego tłumaczenia",
"newNote": "Nowa notatka",
"alternativeNames": "Alternatywne nazwy",
"successfullyUpdated": "Ćwiczenie zostało pomyślnie zaktualizowane. Ze względu na buforowanie może minąć trochę czasu zanim zmiany będą widoczne w całej aplikacji.",
"exerciseNotTranslatedBody": "To ćwiczenie nie jest obecnie dostępne w aktualnie wybranym języku. Chcesz pomóc w tłumaczeniu?",
"notEnoughRights": "Możesz dodawać ćwiczenia tylko wtedy, gdy Twoje konto jest starsze niż {{days}} dni i zweryfikowałeś swój adres e-mail",
"translateExerciseNow": "Przetłumacz to ćwiczenie teraz",
"deleteExerciseBody": "Czy chcesz usunąć ćwiczenie „{{name}}”? Możesz usunąć bieżące tłumaczenie {{language}} lub całe ćwiczenie ze wszystkimi tłumaczeniami, obrazami itp.",
"deleteExerciseFull": "Usuń całe ćwiczenie",
"compatibleImagesCC": "Obrazy muszą być zgodne z licencją CC BY SA. Jeśli masz wątpliwości przesyłaj tylko zdjęcia które sam zrobiłeś.",
"deleteTranslation": "Usuń tłumaczenie",
"step1HeaderBasics": "Podstawy po angielsku"
},
"noResults": "Brak wyników",
"noResultsDescription": "Nie znaleziono wyników dla tego zapytania, rozważ zmniejszenie liczby filtrów.",
"nutritionalPlan": "Plan diety",
"server": {
"arms": "Ramiona",
"back": "Plecy",
"barbell": "Sztanga",
"bench": "Ławka",
"calves": "Łydki",
"chest": "Klatka piersiowa",
"dumbbell": "Hantle",
"gym_mat": "Mata gimnastyczna",
"incline_bench": "Ławka skośna",
"kettlebell": "Odważniki",
"kilometers": "Kilometry",
"legs": "Nogi",
"miles": "Mile",
"minutes": "Minuty",
"none_(bodyweight_exercise)": "brak (ćwiczenie z masą ciała)",
"pull-up_bar": "Drążek",
"repetitions": "Powtórzenia",
"seconds": "Sekundy",
"shoulders": "Barki",
"swiss_ball": "Piłka gimnastyczna",
"sz-bar": "Gryf łamany",
"until_failure": "Do upadku",
"pull_up_bar": "Drążek do podciągania",
"biceps": "Biceps",
"lower_back": "Dolna część pleców",
"triceps": "Triceps",
"none__bodyweight_exercise_": "brak (ćwiczenie z masą ciała)",
"sz_bar": "Gryf łamany",
"glutes": "Pośladki",
"lats": "Mięsień najszerszy grzbietu",
"quads": "Mięsień czworogłowy uda",
"hamstrings": "Mięsień dwugłowy uda",
"abs": "Brzuch"
},
"submit": "Wyślij",
"weight": "Waga",
"workout": "Trening",
"description": "Opis",
"equipment": "Sprzęt",
"exercises": "Ćwiczenia",
"missingExercise": "Brakuje Ci określonego ćwiczenia ?",
"missingExerciseDescription": "Pomóż społeczności, dodając to !",
"muscles": "Mięśnie",
"noEquipment": "Bez sprzętu",
"notes": "Notatki",
"primaryMuscles": "Mięśnie główne",
"searchExerciseName": "Szukaj według nazw ćwiczeń",
"secondaryMuscles": "Mięśnie pomocnicze"
},
"noResults": "Brak wyników",
"noResultsDescription": "Nie znaleziono wyników dla tego zapytania, rozważ zmniejszenie liczby filtrów.",
"nutritionalPlan": "Plan diety",
"server": {
"arms": "Ramiona",
"back": "Plecy",
"barbell": "Sztanga",
"bench": "Ławka",
"calves": "Łydki",
"chest": "Klatka piersiowa",
"dumbbell": "Hantle",
"gym_mat": "Mata gimnastyczna",
"incline_bench": "Ławka skośna",
"kettlebell": "Odważniki",
"kilometers": "Kilometry",
"legs": "Nogi",
"miles": "Mile",
"minutes": "Minuty",
"none_(bodyweight_exercise)": "brak (ćwiczenie z masą ciała)",
"pull-up_bar": "Drążek",
"repetitions": "Powtórzenia",
"seconds": "Sekundy",
"shoulders": "Barki",
"swiss_ball": "Piłka gimnastyczna",
"sz-bar": "Gryf łamany",
"until_failure": "Do upadku"
},
"submit": "Wyślij",
"weight": "Waga",
"workout": "Trening"
}
"translation": "Tłumaczenie",
"images": "Obrazy",
"overview": "Przegląd",
"preferences": "Preferencje",
"continue": "Kontynuuj",
"language": "Język",
"forms": {
"fieldRequired": "To pole jest wymagane",
"valueTooLong": "Wartość jest za długa",
"supportedImageFormats": "Obsługiwane są tylko pliki JPEG, PNG i WEBP poniżej 20 MB",
"valueTooShort": "Wartość jest za krótka"
},
"category": "Kategoria",
"English": "Angielski",
"save": "Zapisz",
"videos": "Wideo",
"cannotBeUndone": "Tej czynności nie można cofnąć.",
"cancel": "Anuluj",
"name": "Nazwa",
"loading": "Ładowanie...",
"goBack": "Powrót"
}

View File

@@ -1,57 +1,57 @@
{
"add": "Добавить",
"addEntry": "Добавить запись",
"close": "Закрыть",
"currentWeight": "Текущий вес",
"date": "Дата",
"days": "Дней",
"delete": "Удалить",
"difference": "Разница",
"edit": "Редактировать",
"exercises": {
"alsoKnownAs": "Другое название:",
"category": "Категория",
"contributeExercise": "Добавить упражнение",
"description": "Описание",
"equipment": "Снаряжение",
"exercises": "Упражнения",
"missingExercise": "Нет определённого упражнения?",
"missingExerciseDescription": "Помогите сообществу, добавив его!",
"muscles": "Мышцы",
"noEquipment": "Без снаряжения",
"notes": "Заметки",
"primaryMuscles": "Крупные мышцы",
"searchExerciseName": "Поиск по названию",
"secondaryMuscles": "Вторичные мышцы"
},
"noResults": "Нет результатов",
"noResultsDescription": "Для этого запроса не найдено результатов, рассмотрите возможность уменьшения количества фильтров.",
"nutritionalPlan": "План питания",
"server": {
"arms": "Руки",
"back": "Спина",
"barbell": "Штанга",
"bench": "Скамья",
"calves": "Икры",
"chest": "Грудь",
"dumbbell": "Гантель",
"gym_mat": "Спортивный коврик",
"incline_bench": "Наклонная скамья",
"kettlebell": "Гиря",
"kilometers": "Километры",
"legs": "Ноги",
"miles": "Мили",
"minutes": "Минуты",
"none_(bodyweight_exercise)": "Ничего (упражнения с собственным весом)",
"pull-up_bar": "Турник",
"repetitions": "Повторения",
"seconds": "Секунды",
"shoulders": "Плечи",
"swiss_ball": "Фитбол",
"sz-bar": "Изогнутый SZ гриф",
"until_failure": "До неудачи"
},
"submit": "Отправить",
"weight": "Вес",
"workout": "Тренировка"
}
"add": "Добавить",
"addEntry": "Добавить запись",
"close": "Закрыть",
"currentWeight": "Текущий вес",
"date": "Дата",
"days": "Дней",
"delete": "Удалить",
"difference": "Разница",
"edit": "Редактировать",
"exercises": {
"alsoKnownAs": "Другое название:",
"category": "Категория",
"contributeExercise": "Добавить упражнение",
"description": "Описание",
"equipment": "Снаряжение",
"exercises": "Упражнения",
"missingExercise": "Нет определённого упражнения?",
"missingExerciseDescription": "Помогите сообществу, добавив его!",
"muscles": "Мышцы",
"noEquipment": "Без снаряжения",
"notes": "Заметки",
"primaryMuscles": "Крупные мышцы",
"searchExerciseName": "Поиск по названию",
"secondaryMuscles": "Вторичные мышцы"
},
"noResults": "Нет результатов",
"noResultsDescription": "Для этого запроса не найдено результатов, рассмотрите возможность уменьшения количества фильтров.",
"nutritionalPlan": "План питания",
"server": {
"arms": "Руки",
"back": "Спина",
"barbell": "Штанга",
"bench": "Скамья",
"calves": "Икры",
"chest": "Грудь",
"dumbbell": "Гантель",
"gym_mat": "Спортивный коврик",
"incline_bench": "Наклонная скамья",
"kettlebell": "Гиря",
"kilometers": "Километры",
"legs": "Ноги",
"miles": "Мили",
"minutes": "Минуты",
"none_(bodyweight_exercise)": "Ничего (упражнения с собственным весом)",
"pull-up_bar": "Турник",
"repetitions": "Повторения",
"seconds": "Секунды",
"shoulders": "Плечи",
"swiss_ball": "Фитбол",
"sz-bar": "Изогнутый SZ гриф",
"until_failure": "До неудачи"
},
"submit": "Отправить",
"weight": "Вес",
"workout": "Тренировка"
}

View File

@@ -22,7 +22,29 @@
"primaryMuscles": "Birincil kaslar",
"searchExerciseName": "Egzersiz adına göre ara",
"secondaryMuscles": "İkincil kaslar",
"variations": "Varyasyonlar"
"variations": "Varyasyonlar",
"deleteTranslation": "Çeviriyi sil",
"deleteExerciseFull": "Tüm egzersizi sil",
"newNote": "Yeni not",
"basics": "Temeller",
"exerciseNotTranslatedBody": "Seçtiğiniz egzersiz şu anda dilinde mevcut değil. Çeviriye katkıda bulunmak ister misiniz?",
"changeExerciseLanguage": "Egzersizin dilini değiştir",
"exerciseNotTranslated": "Çeviri mevcut değil",
"notEnoughRights": "Yalnızca hesabınız {{days}} günden eskiyse ve e-posta adresinizi doğruladıysanız egzersizlere katkıda bulunabilirsiniz",
"description": "Açıklama",
"notEnoughRightsHeader": "Egzersizlere katkıda bulunamazsın",
"translateExerciseNow": "Bu egzersizi şimdi çevir",
"checkInformationBeforeSubmitting": "Lütfen egzersinizi göndermeden önce girdiğiniz bilgilerin doğru olduğunu kontrol edin",
"submitExercise": "Egzersizi gönder",
"successfullyUpdated": "Egzersiz başarıyla güncellendi. Önbelleğe alma nedeniyle, değişikliklerin uygulama genelinde görünmesi biraz zaman alabilir.",
"alternativeNames": "Alternatif isimler",
"compatibleImagesCC": "Görseller CC BY SA lisansı ile uyumlu olmalıdır. Emin değilseniz, yalnızca kendi çektiğiniz fotoğrafları yükleyin.",
"whatVariationsExist": "Varsa, bu alıştırmanın hangi varyasyonları mevcuttur?",
"notesHelpText": "Notlar \"vücudunuzu dik tutun\" gibi egzersizin nasıl yapılacağına dair kısa yorumlardır",
"filterVariations": "Varyasyonları filtrelemek için egzersiz adı girin",
"deleteExerciseBody": "\"{{name}}\" egzersizini silmek istiyor musunuz? İster {{language}} çeviriyi silebilirsiniz, isterseniz alıştırmanın tamamını silebilirsiniz tüm çeviriler, resimler vb.",
"step1HeaderBasics": "İngilizce'de temel bilgiler",
"identicalExercisePleaseDiscard": "Eklediğiniz egzersizle aynı olan bir egzersiz fark ederseniz, lütfen taslağınızı atın ve bunun yerine o egzersizi düzenleyin."
},
"noResults": "Sonuç yok",
"noResultsDescription": "Bu sorgu için sonuç bulunamadı, filtre sayısını azaltmayı düşünün.",
@@ -50,7 +72,18 @@
"shoulders": "Omuzlar",
"swiss_ball": "Egzersiz topu",
"sz-bar": "SZ çubuğu",
"until_failure": "Başarısızlığa kadar"
"until_failure": "Başarısızlığa kadar",
"abs": "Karın",
"lats": "Lat kasları",
"glutes": "Kalça kasları",
"biceps": "Pazılar",
"lower_back": "Alt sırt",
"hamstrings": "Hamstringler",
"quads": "Quad kasları",
"none__bodyweight_exercise_": "yok (vücut ağırlığı egzersizi)",
"sz_bar": "Z bar",
"pull_up_bar": "Barfiks çubuğu",
"triceps": "Tricep kasları"
},
"submit": "Gönder",
"weight": "Ağırlık",
@@ -59,5 +92,22 @@
"description": "Açıklama",
"name": "İsim",
"save": "Kaydet",
"loading": "Yükleniyor..."
"loading": "Yükleniyor...",
"language": "Dil",
"forms": {
"supportedImageFormats": "Sadece 20 Mb'ın altındaki JPEG, PNG ve WEBP dosyaları desteklenir",
"valueTooShort": "Değer çok kısa",
"valueTooLong": "Değer çok uzun",
"fieldRequired": "Bu alan gereklidir"
},
"preferences": "Tercihler",
"continue": "Devam et",
"overview": "Genel Bakış",
"images": "Resimler",
"English": "İngilizce",
"goBack": "Sırt",
"videos": "Videolar",
"cancel": "İptal",
"cannotBeUndone": "Bu eylem geri alınamaz.",
"translation": "Çeviri"
}

View File

@@ -1,56 +1,57 @@
{
"weight": "重量",
"submit": "提交",
"edit": "编辑",
"add": "添加",
"difference": "差异",
"days": "天数",
"nutritionalPlan": "饮食计划",
"addEntry": "添加条目",
"currentWeight": "目前重量",
"workout": "训练",
"date": "日期",
"delete": "删除",
"exercises": {
"primaryMuscles": "主动肌",
"secondaryMuscles": "次动肌",
"searchExerciseName": "按动作名称搜索",
"alsoKnownAs": "也被称为:",
"notes": "注",
"description": "描述",
"contributeExercise": "贡献一个新动作",
"exercises": "动作",
"missingExercise": "缺少某项动作?",
"missingExerciseDescription": "通过添加贡献来帮助社区!",
"category": "类别",
"muscles": "肌肉",
"noEquipment": "无器械",
"equipment": "器械"
},
"server": {
"arms": "手臂",
"dumbbell": "哑铃",
"gym_mat": "体操垫",
"back": "背部",
"incline_bench": "倾斜卧推架",
"kettlebell": "壶铃",
"pull-up_bar": "单杠",
"sz-bar": "SZ 杠铃",
"swiss_ball": "健身球",
"none_(bodyweight_exercise)": "无(自重动作)",
"kilometers": "千米",
"miles": "英里",
"minutes": "分钟",
"repetitions": "重复次数",
"seconds": "秒",
"until_failure": "直到失败",
"bench": "卧推架",
"calves": "小腿",
"chest": "胸部",
"legs": "腿部",
"shoulders": "肩部",
"barbell": "杠铃"
},
"noResults": "无结果",
"noResultsDescription": "找不到此查询的结果,请考虑减少过滤器的数量。"
"weight": "重量",
"submit": "提交",
"edit": "编辑",
"add": "添加",
"difference": "差异",
"days": "天数",
"nutritionalPlan": "饮食计划",
"addEntry": "添加条目",
"currentWeight": "目前重量",
"workout": "训练",
"date": "日期",
"delete": "删除",
"exercises": {
"primaryMuscles": "主动肌",
"secondaryMuscles": "次动肌",
"searchExerciseName": "按动作名称搜索",
"alsoKnownAs": "也被称为:",
"notes": "注",
"description": "描述",
"contributeExercise": "贡献一个新动作",
"exercises": "动作",
"missingExercise": "缺少某项动作?",
"missingExerciseDescription": "通过添加贡献来帮助社区!",
"category": "类别",
"muscles": "肌肉",
"noEquipment": "无器械",
"equipment": "器械"
},
"server": {
"arms": "手臂",
"dumbbell": "哑铃",
"gym_mat": "体操垫",
"back": "背部",
"incline_bench": "倾斜卧推架",
"kettlebell": "壶铃",
"pull-up_bar": "单杠",
"sz-bar": "SZ 杠铃",
"swiss_ball": "健身球",
"none_(bodyweight_exercise)": "无(自重动作)",
"kilometers": "千米",
"miles": "英里",
"minutes": "分钟",
"repetitions": "重复次数",
"seconds": "秒",
"until_failure": "直到失败",
"bench": "卧推架",
"calves": "小腿",
"chest": "胸部",
"legs": "腿部",
"shoulders": "肩部",
"barbell": "杠铃"
},
"noResults": "无结果",
"noResultsDescription": "找不到此查询的结果,请考虑减少过滤器的数量。",
"loading": "加载中..."
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -15,7 +15,11 @@
{% block title %}{{title}}{% endblock %}
{% block content %}
{% crispy form %}
{% if form %}
{% crispy form %}
{% else %}
Looks like you clicked on an invalid link. Please try again.
{% endif %}
{% endblock %}

View File

@@ -9,6 +9,13 @@
{% for language in language_list %}
<a href="{% url 'core:language:view' language.id %}" class="list-group-item">
<span class="glyphicon glyphicon-chevron-right float-right"></span>
{% with 'images/icons/flag-'|add:language.short_name|add:'.svg' as flagname %}
<img src="{% static flagname %}"
width="18"
alt="{% translate language.full_name %}"
title="{% translate language.full_name %}"
style="">
{% endwith %}
{{ language.full_name }}
</a>
{% empty %}

View File

@@ -29,45 +29,6 @@
</tr>
</tbody>
</table>
<h4>{% translate "Configuration" %}</h4>
<p>{% blocktranslate %}Use the configuration to select in what languages the
exercises and ingredients will be shown for the current language (for example
the exercises should be shown in languages A, B and C; the ingredients only
in A).{% endblocktranslate %}</p>
<table class="table">
<thead>
<tr>
<th>{% translate "Language full name" %}</th>
<th>{% translate "Show" %}</th>
</tr>
</thead>
<tbody>
{% for config in view_language.language_source.all %}
{% ifchanged config.get_item_display %}
<tr>
<td colspan="2" class="active" style="text-align:center;">{{config.get_item_display}}</td>
</tr>
{% endifchanged %}
<tr>
<td>
<a href="{% url 'config:language_config:edit' config.id %}" class="wger-modal-dialog">
{{config.language_target.full_name}}
</a>
</td>
<td>
{% if config.show %}
<span class="{% fa_class 'check' %} text-success"></span>
{% else %}
<span class="{% fa_class 'times' %}"></span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -187,7 +187,6 @@
{% with 'images/icons/flag-'|add:language.short_name|add:'.svg' as flagname %}
<img src="{% static flagname %}"
width="18"
height="11"
alt="{% translate language.full_name %}"
title="{% translate language.full_name %}"
style="">

View File

@@ -46,6 +46,7 @@ class RegistrationTestCase(WgerTestCase):
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': True,
'TWITTER': False,
'MIN_ACCOUNT_AGE_TO_TRUST': 21,
}
):
response = self.client.get(reverse('core:user:registration'))
@@ -57,6 +58,7 @@ class RegistrationTestCase(WgerTestCase):
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': True,
'TWITTER': False,
'MIN_ACCOUNT_AGE_TO_TRUST': 21,
}
):
response = self.client.get(reverse('core:user:registration'))
@@ -106,6 +108,66 @@ class RegistrationTestCase(WgerTestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(count_before + 1, count_after)
# Password too short
registration_data['password1'] = 'abc123'
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Password is "password" (commonly used)
registration_data['password1'] = 'password'
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Password is entirely numeric
registration_data['password1'] = '123456789'
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Passwords don't match
registration_data['password2'] = 'quai8fai7Zaeq'
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# First password is missing
registration_data['password1'] = ""
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Second password is missing
registration_data['password2'] = ""
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Username is too long
long_user = (
"my_username_is_"
"wayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
"_toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
"_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"
)
registration_data['username'] = long_user
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Username contains invalid symbol
registration_data['username'] = "username!"
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
# Username is missing
registration_data['username'] = ""
response = self.client.post(reverse('core:user:registration'), registration_data)
self.assertFalse(response.context['form'].is_valid())
self.user_logout()
def test_registration_deactivated(self):
"""
Test that with deactivated registration no users can register
@@ -116,6 +178,7 @@ class RegistrationTestCase(WgerTestCase):
'USE_RECAPTCHA': False,
'ALLOW_GUEST_USERS': True,
'ALLOW_REGISTRATION': False,
'MIN_ACCOUNT_AGE_TO_TRUST': 21,
}
):

View File

@@ -64,6 +64,7 @@ class DemoUserTestCase(WgerTestCase):
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': False,
'TWITTER': False,
'MIN_ACCOUNT_AGE_TO_TRUST': 21,
}
):
self.assertEqual(self.count_temp_users(), 1)

View File

@@ -21,6 +21,7 @@ import logging
# Django
from django.conf import settings
from django.db.models import Q
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django.utils.translation import gettext as _
from django.views.decorators.cache import cache_page
@@ -40,7 +41,7 @@ from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
# wger
from wger.config.models import LanguageConfig
from wger.core.models import Language
from wger.exercises.api.permissions import CanContributeExercises
from wger.exercises.api.serializers import (
EquipmentSerializer,
@@ -75,7 +76,7 @@ from wger.utils.constants import (
HTML_STYLES_WHITELIST,
HTML_TAG_WHITELIST,
)
from wger.utils.language import load_item_languages
from wger.utils.language import load_language
logger = logging.getLogger(__name__)
@@ -262,45 +263,43 @@ 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)
response = {}
results = []
json_response = {}
if q:
languages = load_item_languages(
LanguageConfig.SHOW_ITEM_EXERCISES, language_code=request.GET.get('language', None)
)
name_lookup = Q(name__icontains=q) | Q(alias__alias__icontains=q)
exercises = (
Exercise.objects.filter(name_lookup).all().filter(
language__in=languages
).order_by('exercise_base__category__name', 'name').distinct()
)
if not q:
return Response(response)
for exercise in exercises:
if exercise.main_image:
image_obj = exercise.main_image
image = image_obj.image.url
t = get_thumbnailer(image_obj.image)
thumbnail = t.get_thumbnail(aliases.get('micro_cropped')).url
else:
image = None
thumbnail = None
language = load_language(language_code)
exercises = Exercise.objects\
.filter(Q(name__icontains=q) | Q(alias__alias__icontains=q))\
.filter(language=language)\
.order_by('exercise_base__category__name', 'name')\
.distinct()
exercise_json = {
'value': exercise.name,
'data': {
'id': exercise.id,
'base_id': exercise.exercise_base_id,
'name': exercise.name,
'category': _(exercise.category.name),
'image': image,
'image_thumbnail': thumbnail
}
for exercise in exercises:
image = None
thumbnail = None
if exercise.main_image:
image_obj = exercise.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,
'data': {
'id': exercise.id,
'base_id': exercise.exercise_base_id,
'name': exercise.name,
'category': _(exercise.category.name),
'image': image,
'image_thumbnail': thumbnail
}
results.append(exercise_json)
json_response['suggestions'] = results
return Response(json_response)
}
results.append(exercise_json)
response['suggestions'] = results
return Response(response)
class ExerciseInfoViewset(viewsets.ReadOnlyModelViewSet):

View File

@@ -69,6 +69,7 @@ class Command(BaseCommand):
exercise_data['description'] = exercise.description
exercise_data['license'] = exercise.license.short_name
exercise_data['author'] = exercise.license_author
exercise_data['aliases'] = ','.join([a.alias for a in exercise.alias_set.all()])
data[language.short_name] = exercise_data
out.append(data)
@@ -81,8 +82,8 @@ class Command(BaseCommand):
header += [
f'{language.short_name}:uuid',
f'{language.short_name}:name',
f'{language.short_name}:description',
f'{language.short_name}:alias',
f'{language.short_name}:description',
f'{language.short_name}:license',
f'{language.short_name}:author',
]
@@ -100,8 +101,8 @@ class Command(BaseCommand):
data += [
entry[language.short_name]['uuid'],
entry[language.short_name]['name'],
entry[language.short_name]['aliases'],
entry[language.short_name]['description'],
'', # Alias field is still empty for all
entry[language.short_name]['license'],
entry[language.short_name]['author'],
]

View File

@@ -38,14 +38,12 @@ from django.views.generic import (
)
# wger
from wger.config.models import LanguageConfig
from wger.exercises.models import Equipment
from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
from wger.utils.generic_views import (
WgerDeleteMixin,
WgerFormMixin,
)
from wger.utils.language import load_item_languages
logger = logging.getLogger(__name__)

View File

@@ -35,13 +35,11 @@ from django.views.generic import (
)
# wger
from wger.config.models import LanguageConfig
from wger.exercises.models import Muscle
from wger.utils.generic_views import (
WgerDeleteMixin,
WgerFormMixin,
)
from wger.utils.language import load_item_languages
logger = logging.getLogger(__name__)

View File

@@ -1,31 +1,31 @@
{% load i18n %}
{% translate "Lower back" %}
{% translate "Seconds" %}
{% translate "Until Failure" %}
{% translate "Repetitions" %}
{% translate "Dumbbell" %}
{% translate "Abs" %}
{% translate "Arms" %}
{% translate "Legs" %}
{% translate "Dumbbell" %}
{% translate "Biceps" %}
{% translate "SZ-Bar" %}
{% translate "Miles" %}
{% translate "Kettlebell" %}
{% translate "Swiss Ball" %}
{% translate "none (bodyweight exercise)" %}
{% translate "Calves" %}
{% translate "Back" %}
{% translate "Lower back" %}
{% translate "Lats" %}
{% translate "Hamstrings" %}
{% translate "Bench" %}
{% translate "Glutes" %}
{% translate "Kilometers" %}
{% translate "Shoulders" %}
{% translate "Triceps" %}
{% translate "Quads" %}
{% translate "none (bodyweight exercise)" %}
{% translate "Barbell" %}
{% translate "Lats" %}
{% translate "Until Failure" %}
{% translate "Gym mat" %}
{% translate "Glutes" %}
{% translate "Bench" %}
{% translate "Pull-up bar" %}
{% translate "Calves" %}
{% translate "Arms" %}
{% translate "Biceps" %}
{% translate "Kettlebell" %}
{% translate "Back" %}
{% translate "Chest" %}
{% translate "Swiss Ball" %}
{% translate "Minutes" %}
{% translate "Seconds" %}
{% translate "Miles" %}
{% translate "Incline bench" %}
{% translate "Hamstrings" %}
{% translate "Legs" %}
{% translate "Quads" %}
{% translate "Minutes" %}
{% translate "Chest" %}
{% translate "Gym mat" %}
{% translate "Pull-up bar" %}
{% translate "Barbell" %}
{% translate "Triceps" %}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,10 @@ from rest_framework.decorators import action
from rest_framework.response import Response
# wger
from wger.exercises.models import Exercise
from wger.exercises.models import (
Exercise,
ExerciseBase,
)
from wger.manager.api.serializers import (
DaySerializer,
ScheduleSerializer,
@@ -93,17 +96,17 @@ class WorkoutViewSet(viewsets.ModelViewSet):
"""
Returns processed log data for graphing
Basically, these are the logs for the workout and for a specific exercise.
Basically, these are the logs for the workout and for a specific exercise base.
If on a day there are several entries with the same number of repetitions,
but different weights, only the entry with the higher weight is shown in the chart
"""
execise_id = request.GET.get('id')
if not execise_id:
return Response("Please provide an exercise ID in the 'id' GET parameter")
base_id = request.GET.get('id')
if not base_id:
return Response("Please provide an base ID in the 'id' GET parameter")
exercise = get_object_or_404(Exercise, pk=execise_id)
logs = exercise.workoutlog_set.filter(
base = get_object_or_404(ExerciseBase, pk=base_id)
logs = base.workoutlog_set.filter(
user=self.request.user,
weight_unit__in=(1, 2),
repetition_unit=1,

View File

@@ -58,10 +58,7 @@ from wger.nutrition.models import (
NutritionPlan,
WeightUnit,
)
from wger.utils.language import (
load_ingredient_languages,
load_language,
)
from wger.utils.language import load_language
from wger.utils.viewsets import WgerOwnerObjectModelViewSet
@@ -160,39 +157,39 @@ def search(request):
requested_language = request.GET.get('language', None)
results = []
json_response = {}
if term:
if requested_language:
languages = [load_language(requested_language)]
if not term:
return Response(json_response)
language = load_language(requested_language)
ingredients = Ingredient.objects.filter(
name__icontains=term,
language=language,
status=Ingredient.STATUS_ACCEPTED,
)[:100]
for ingredient in ingredients:
if hasattr(ingredient, 'image'):
image_obj = ingredient.image
image = image_obj.image.url
t = get_thumbnailer(image_obj.image)
thumbnail = t.get_thumbnail(aliases.get('micro_cropped')).url
else:
languages = load_ingredient_languages(request)
ingredients = Ingredient.objects.filter(
name__icontains=term,
language__in=languages,
status=Ingredient.STATUS_ACCEPTED,
)[:100]
ingredient.get_image(request)
image = None
thumbnail = None
for ingredient in ingredients:
if hasattr(ingredient, 'image'):
image_obj = ingredient.image
image = image_obj.image.url
t = get_thumbnailer(image_obj.image)
thumbnail = t.get_thumbnail(aliases.get('micro_cropped')).url
else:
ingredient.get_image(request)
image = None
thumbnail = None
ingredient_json = {
'value': ingredient.name,
'data': {
'id': ingredient.id,
'name': ingredient.name,
'image': image,
'image_thumbnail': thumbnail
}
ingredient_json = {
'value': ingredient.name,
'data': {
'id': ingredient.id,
'name': ingredient.name,
'image': image,
'image_thumbnail': thumbnail
}
results.append(ingredient_json)
json_response['suggestions'] = results
}
results.append(ingredient_json)
json_response['suggestions'] = results
return Response(json_response)

View File

@@ -97,7 +97,6 @@ class BmiForm(forms.ModelForm):
height = forms.DecimalField(
widget=Html5NumberInput(),
max_value=999,
label=_('Height (cm)'),
)
weight = forms.DecimalField(
widget=Html5NumberInput(),
@@ -111,6 +110,12 @@ class BmiForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(BmiForm, self).__init__(*args, **kwargs)
if 'initial' in kwargs: #if the form is rendering for the first time
self['height'].label = _('Height (cm)'
) if kwargs['initial']['use_metric'] else _('Height (in)')
self['weight'].label = _('Weight (kg)'
) if kwargs['initial']['use_metric'] else _('Weight (lbs)')
self.helper = FormHelper()
self.helper.form_action = reverse('nutrition:bmi:calculate')
self.helper.form_class = 'wger-form'

View File

@@ -45,7 +45,7 @@ class BmiTestCase(WgerTestCase):
response = self.client.get(reverse('nutrition:bmi:view'))
self.assertEqual(response.status_code, 200)
def test_calculator(self):
def test_calculator_metric(self):
"""
Tests the calculator itself
"""
@@ -63,6 +63,42 @@ class BmiTestCase(WgerTestCase):
self.assertEqual(Decimal(bmi['weight']), Decimal(80))
self.assertEqual(Decimal(bmi['height']), Decimal(180))
def test_calculator_metric_low_height(self):
"""
Tests the calculator when the height is too low. Should trigger an error message.
"""
self.user_login('test')
profile = UserProfile.objects.get(user__username='test')
profile.save()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {
'height': 115,
'weight': 76
}
)
self.assertEqual(response.status_code, 406)
response = json.loads(response.content.decode('utf8'))
self.assertTrue('error' in response)
def test_calculator_metric_high_height(self):
"""
Tests the calculator when the height is too low. Should trigger an error message.
"""
self.user_login('test')
profile = UserProfile.objects.get(user__username='test')
profile.save()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {
'height': 250,
'weight': 82
}
)
self.assertEqual(response.status_code, 406)
response = json.loads(response.content.decode('utf8'))
self.assertTrue('error' in response)
def test_calculator_imperial(self):
"""
Tests the calculator using imperial units
@@ -74,15 +110,53 @@ class BmiTestCase(WgerTestCase):
profile.save()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {
'height': 180,
'weight': 176.36
'height': 73,
'weight': 176
}
)
self.assertEqual(response.status_code, 200)
bmi = json.loads(response.content.decode('utf8'))
self.assertEqual(Decimal(bmi['bmi']), Decimal(24.69).quantize(TWOPLACES))
self.assertEqual(Decimal(bmi['weight']), Decimal(176.36).quantize(TWOPLACES))
self.assertEqual(Decimal(bmi['height']), Decimal(180))
self.assertEqual(Decimal(bmi['bmi']), Decimal(23.33).quantize(TWOPLACES))
self.assertEqual(Decimal(bmi['weight']), Decimal(176).quantize(TWOPLACES))
self.assertEqual(Decimal(bmi['height']), Decimal(73))
def test_calculator_imperial_low_height(self):
"""
Tests the calculator when the height is too low. Should trigger an error message.
"""
self.user_login('test')
profile = UserProfile.objects.get(user__username='test')
profile.weight_unit = 'lb'
profile.save()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {
'height': 48,
'weight': 145
}
)
self.assertEqual(response.status_code, 406)
response = json.loads(response.content.decode('utf8'))
self.assertTrue('error' in response)
def test_calculator_imperial_high_height(self):
"""
Tests the calculator when the height is too low. Should trigger an error message.
"""
self.user_login('test')
profile = UserProfile.objects.get(user__username='test')
profile.weight_unit = 'lb'
profile.save()
response = self.client.post(
reverse('nutrition:bmi:calculate'), {
'height': 98,
'weight': 145
}
)
self.assertEqual(response.status_code, 406)
response = json.loads(response.content.decode('utf8'))
self.assertTrue('error' in response)
def test_automatic_weight_entry(self):
"""

View File

@@ -23,10 +23,12 @@ import logging
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render
from django.utils.translation import gettext as _
# wger
from wger.nutrition.forms import BmiForm
from wger.utils import helpers
from wger.utils.units import AbstractHeight
logger = logging.getLogger(__name__)
@@ -44,7 +46,8 @@ def view(request):
context = {}
form_data = {
'height': request.user.userprofile.height,
'weight': request.user.userprofile.weight
'weight': request.user.userprofile.weight,
'use_metric': request.user.userprofile.use_metric
}
context['form'] = BmiForm(initial=form_data)
return render(request, 'bmi/form.html', context)
@@ -59,6 +62,14 @@ def calculate(request):
data = []
form = BmiForm(request.POST, instance=request.user.userprofile)
output_height = request.POST['height']
if not request.user.userprofile.use_metric:
request_copy = request.POST.copy()
output_height = request_copy['height']
request_copy['height'] = AbstractHeight(request_copy['height'], mode='inches').cm
form = BmiForm(request_copy, instance=request.user.userprofile)
if form.is_valid():
form.save()
@@ -69,12 +80,23 @@ def calculate(request):
result = {
'bmi': '{0:.2f}'.format(bmi),
'weight': form.cleaned_data['weight'],
'height': request.user.userprofile.height,
'height': output_height,
}
data = json.dumps(result, cls=helpers.DecimalJsonEncoder)
response = HttpResponse(data, 'application/json')
else:
help_message = {
('error'): _('Please make sure your height is within the appropriate range.'),
}
if request.user.userprofile.use_metric:
help_message['cm_range'] = _('140 to 230')
else:
help_message['in_range'] = _('56 to 90')
data = json.dumps(help_message)
response = HttpResponse(data, 'application/json')
response.status_code = 406
# Return the results to the client
return HttpResponse(data, 'application/json')
return response
def chart_data(request):

View File

@@ -57,10 +57,7 @@ from wger.utils.generic_views import (
WgerDeleteMixin,
WgerFormMixin,
)
from wger.utils.language import (
load_ingredient_languages,
load_language,
)
from wger.utils.language import load_language
logger = logging.getLogger(__name__)
@@ -81,12 +78,9 @@ class IngredientListView(ListView):
def get_queryset(self):
"""
Filter the ingredients the user will see by its language
(the user can also want to see ingredients in English, in addition to his
native language, see load_ingredient_languages)
"""
languages = load_ingredient_languages(self.request)
return (Ingredient.objects.accepted().filter(language__in=languages).only('id', 'name'))
language = load_language()
return Ingredient.objects.accepted().filter(language=language).only('id', 'name')
def get_context_data(self, **kwargs):
"""

View File

@@ -229,6 +229,8 @@ LANGUAGES = (
('pl', 'Polish'),
('uk', 'Ukrainian'),
('tr', 'Turkish'),
('zh', 'Chinese simplified'),
('ca', 'Catalan'),
)
# Default language code for this installation.
@@ -286,7 +288,7 @@ CACHES = {
#
# Django Axes
#
AXES_ENABLED = False
AXES_ENABLED = True
AXES_FAILURE_LIMIT = 10
AXES_COOLOFF_TIME = timedelta(minutes=30)
AXES_LOCKOUT_TEMPLATE = None
@@ -484,6 +486,7 @@ WGER_SETTINGS = {
'ALLOW_UPLOAD_VIDEOS': False,
'USE_CELERY': False,
'DOWNLOAD_FROM_OFF': False,
'MIN_ACCOUNT_AGE_TO_TRUST': 21,
'EMAIL_FROM': 'wger Workout Manager <wger@example.com>',
'EXERCISE_CACHE_TTL': 3600,
'TWITTER': False,

View File

@@ -243,7 +243,6 @@ def load_fixtures(context, settings_path=None):
call_command("loaddata", "setting_weight_units.json")
# Config
call_command("loaddata", "language_config.json")
call_command("loaddata", "gym_config.json")
# Manager

View File

@@ -54,7 +54,6 @@ class CacheKeyMapper:
# Keys used by the cache
LANGUAGE_CACHE_KEY = 'language-{0}'
LANGUAGE_CONFIG_CACHE_KEY = 'language-config-{0}-{1}'
INGREDIENT_CACHE_KEY = 'ingredient-{0}'
WORKOUT_CANONICAL_REPRESENTATION = 'workout-canonical-representation-{0}'
WORKOUT_LOG_LIST = 'workout-log-hash-{0}'
@@ -72,12 +71,6 @@ class CacheKeyMapper:
"""
return self.LANGUAGE_CACHE_KEY.format(self.get_pk(param))
def get_language_config_key(self, param, item):
"""
Return the language cache key
"""
return self.LANGUAGE_CONFIG_CACHE_KEY.format(self.get_pk(param), item)
def get_ingredient_key(self, param):
"""
Return the ingredient cache key

View File

@@ -21,25 +21,19 @@ from django.core.exceptions import ObjectDoesNotExist
from django.utils import translation
# wger
from wger.config.models import LanguageConfig
from wger.core.models import Language
from wger.utils.cache import cache_mapper
from wger.utils.constants import ENGLISH_SHORT_NAME
logger = logging.getLogger(__name__)
# ************************
# Language functions
# ************************
def load_language(language_code=None):
"""
Returns the currently used language, e.g. to load appropriate exercises
"""
# TODO: perhaps store a language preference in the user's profile?
# Read the first part of a composite language, e.g. 'de-at'
if language_code is None:
used_language = translation.get_language().split('-')[0]
@@ -54,59 +48,7 @@ def load_language(language_code=None):
language = Language.objects.get(short_name=used_language)
except ObjectDoesNotExist:
# No luck, load english as our fall-back language
language = Language.objects.get(short_name="en")
language = Language.objects.get(short_name=ENGLISH_SHORT_NAME)
cache.set(cache_mapper.get_language_key(language.short_name), language)
return language
def load_item_languages(item, language_code=None):
"""
Returns the languages for a data type (exercises, ingredients)
"""
language = load_language(language_code)
languages = cache.get(cache_mapper.get_language_config_key(language, item))
# Load the configurations we are interested in and return the languages
if not languages:
languages = []
config = LanguageConfig.objects.filter(language=language, item=item, show=True)
if not config:
languages.append(Language.objects.get(short_name="en"))
return languages
for i in config:
languages.append(i.language_target)
cache.set(cache_mapper.get_language_config_key(language, item), languages)
return languages
def load_ingredient_languages(request):
"""
Filter the ingredients the user will see by its language.
Additionally, if the user has selected on his preference page that he wishes
to also see the ingredients in English (from the US Department of Agriculture),
show those too.
This only makes sense if the user's language isn't English, as he will be
presented those in that case anyway, so also do a check for this.
"""
language = load_language()
languages = load_item_languages(LanguageConfig.SHOW_ITEM_INGREDIENTS)
# Only registered users have a profile
if request.user.is_authenticated:
profile = request.user.userprofile
show_english = profile.show_english_ingredients
# If the user's language is not english and has the preference, add english to the list
if show_english and language.short_name != 'en':
languages = list(set(languages + [Language.objects.get(pk=2)]))
return languages

View File

@@ -65,33 +65,6 @@ def load_language():
return language
def load_ingredient_languages(request):
"""
Filter the ingredients the user will see by its language.
Additionally, if the user has selected on his preference page that he wishes
to also see the ingredients in English (from the US Department of Agriculture),
show those too.
This only makes sense if the user's language isn't English, as he will be
presented those in that case anyway, so also do a check for this.
"""
language = load_language()
languages = (language.id, )
# Only registered users have a profile
if request.user.is_authenticated:
profile = request.user.userprofile
show_english = profile.show_english_ingredients
# If the user's language is not english and has the preference, add english to the list
if show_english and language.short_name != 'en':
languages = (language.id, 2)
return languages
def render_footer(url, date=None):
"""
Renders the footer used in the different PDFs

View File

@@ -22,7 +22,7 @@ from wger.utils.constants import FOURPLACES
logger = logging.getLogger(__name__)
"""
Weight unit classes
Weight and height unit classes
"""
@@ -115,3 +115,63 @@ class AbstractWeight:
:return: decimal
"""
return self.normalize(self.lb * 16)
class AbstractHeight(object):
"""
Helper class to use when working with sensible (cm) or imperial units.
Internally, all values are stored as cm and are converted only if
needed. For consistency, all results are converted to python decimal and
quantized to four places
"""
CM_IN_INCHES = Decimal(0.393701)
INCHES_IN_CM = Decimal(2.5400)
height = 0
is_cm = True
def __init__(self, height, mode='cm'):
"""
:param height: the numerical height
:param mode: the mode, values 'cm' (default), 'inches' are supported
"""
height = self.normalize(height)
self.height = height
self.is_cm = (mode == 'cm')
@staticmethod
def normalize(value):
"""
Helper method that returns quantized
:param value:
:return: a quantized value to four decimal places
"""
return Decimal(value).quantize(FOURPLACES)
@property
def cm(self):
"""
Return the height in cm
:return: decimal
"""
if self.is_cm:
return self.normalize(self.height)
else:
return self.normalize(self.height * self.INCHES_IN_CM)
@property
def inches(self):
"""
Return the height in inches
:return: decimal
"""
if self.is_cm:
return self.normalize(self.height * self.CM_IN_INCHES)
else:
return self.normalize(self.height)