-
-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue 1124] Adds full imperial unit functionality to BMI Calculator #1185
Conversation
… calculator when imperial units are selected.
…error status codes.
@rolandgeider Would love for you to take a look and let me know what you think when you get a chance. We were able to add these changes in to the existing framework without requiring much refactoring or restructuring. |
nice! I'll try to take a closer look today or tomorrow, but this looks good. The only thing I'd ask you is to mark the error messages and other user facing strings as translatable |
Thanks! Please let me know if you have any other questions/concerns. When you say mark the strings as translatable do you mean within the Pull Request or within the source code? Do you have an example we could reference? I dug around and was unable to find one. |
Sure, in nutrition/forms.py, the strings that are marked with |
Thanks for sharing that. I've applied those changes to the PR. Let me know if that doesn't look right or anything else needs to be tweaked! Thanks for your help. |
wger/nutrition/views/bmi.py
Outdated
response = HttpResponse(data, 'application/json') | ||
else: | ||
help_message = { | ||
_('error'): _('Please make sure your height is within the appropriate range.'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to translate the dictionary key :)
Looks good, thanks! Just added a small comment, then we should be able to merge. Right now you have to enter the height in inches which I'm guessing is probably not very usual? On the other hand adding a real parser to be able to read/write from/to 5'10" is probably a pain, so this can definitely stay |
We definitely agree–we considered using a foot and inches format but we thought it would add some unnecessary complexity and thought it would be best to keep in the same format as the cm. Took care of the remaining issue as well. |
@rolandgeider we're seeing some issues with the _ before the translatable strings not being recognized. Have you run into this before? |
you just need to import it 😄 The "_" name is nothing special, just a convention to make it short so the strings can be read more easily |
Ah got it, thanks for clarifying. Just threw that in there. |
Proposed Changes
Addresses #1124.
Please check that the PR fulfills these requirements
Other questions
(e.g. database migration)?
No
Changes made in collaboration with @gabeliss