QueryJane is a web application developed with Django that allows to connect with companies and experts in different sectors of the cannabis industry. Beta version is available here.
I have added the Django translations system to the project. By using it we can provide internationalization tools to the application. We can offer the application to the final user in different languages. Let me show you how it works.
New Features
Integrated i18n.
Django allows us to indicate which texts should be translated in our templates and in our Python files. By adding some hooks (translation strings) to the Python code and the html files, we are indicating which texts must be translated into the user's language.
I have added translation strings to html files and Python files.
In html files, in order ti indicate to the "Django translations system" that a text must be translated, we must use the trans and the blocktrans template tags. We must load the i18n template tags by adding it into the load template tag at the beginning of the files:
{% load i18n %}
The trans
template tag is used to translate constant strings:
{% trans "Queryjane, the cannabis industry network" %}
The blocktrans
template tag is used to translate complex sentences consisting of literals and variable content :
{% blocktrans %}Job Offers published by {{ company }}{% endblocktrans %}
In Python files, we must use the ugettext function. It’s convention to import this as a shorter alias, _, to save typing:
from django.utils.translation import gettext as _
In order to indicate that a string must be translated, we must use the following convention:
_("This string must be translated")
We are using it, per example, in the form fields label and in the models fields verbose names.
The "name" string must be included into the Django translation system.
All html and Python files have been modified to add the Django translations system.
Activated Spanish site.
After having integrated the Django translation system into all project files, I have added the Spanish translation. To add a new language, it must be included into de settings.py file, in the LANGUAGES
var:
By running the following command, we will generate a .po
file, in which we must add manually the Spanish translation to all strings indicated in the previous step:
docker-compose exec web python manage.py makemessages -l es
Generated .po
file will have the following structure:
msgid "This string must be translated"
msgstr ""
msgid
is a string that must be translated, ans msgstr
is the translation to a determinated language, and must be typed by the developer.
msgid "This string must be translated"
msgstr "Esta cadena debe ser traducida"
I have added all Spanish translations to the .po file.
If we want to add another language, we must include it into the LANGUAGES
variable in the settings.py
file:
And run the following command to generate .po
file to French translations:
docker-compose exec web python manage.py makemessages -l fr
After add all translations into the .po
file, we must compile it by running the following command:
docker-compose exec web python manage.py compilemessages
English version is available on:
Spanish version is available on:
Add Spanish description to companies / Add Spanish description to professional profile.
Users can add Spanish description to their companies. Now is available a new field in the company settings form called Spanish description:
Users can add Spanish description to their professional profiles, there is available a new field called Spanish - Professional profile description in the profile form:
How to contribute?
QueryJane has been developed using the Django framework. You can fork the project, and run it locally is very easy. Follow the steps described in the open source repository installation guide. The project has been configured using Docker. you only need to install Docker and follow these steps.
Future work.
Take a look to our public trello board. This is the easiest way to know our roadmap.
- SEO optimization.
- Javascript files translation.
- Advertising campaign.
If you want to contribute, please join my Discord.
Have happy days ✌
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @ms10398, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @kit.andres I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @kit.andres! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes received
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit