Flask
Gitloc + Flask Quick Start Guide
In this article, we'll show how you can use Gitloc with Flask using this sample project. This is a simple multilingual application based on Flask and i18n.
1. Get the Flask application
To start using Gitloc, you will first need to fork the sample project or create a new application from scratch using the sample creation guide.
If you wish, you can also use any Flask project that has translations clearly separated by locale into separate .json
files. (i.e. /en.json
, /common.en.json
, /en/common.json
etc.).
2. Connect remote repository to Gitloc
To start automation the translation process we should connect the remote repository to the Gitloc.
Open Gitloc platform and sign in
Choose or create a team to work with
Click the "Add repository" button and follow the instructions.
3. Configure gitloc.yaml
for the repository
gitloc.yaml
for the repositoryAll we need to set up automatic translations is to configure gitloc.yaml
in the root folder of our repository.
All available configuration options are described in the gitloc.yaml Reference.
We are ready to translate!
Gitloc automatically detects changes in the localization files of your repository and translate new or modified values. As a result the translations will be committed to the base branch or Gitloc will create a new pull request to review.
Now let's translate the application.
1. Make changes to the localization files
You can now edit defaultLocale
files (e.g. /en/common.json
for defaultLocale: en
).
All new, changed or deleted values of these files will be processed by Gitloc in the next step.
For example, add a new key hello
to /en/welcome.json
2. Push changes
Commit and push all changes into the remote repository.
Gitloc will detect new commits and will soon update all localization files for locales other than the default.
3. Pull translations
At the end we only have to pull translations to our local repository.
If you have your gitloc.yaml
configured as result: push
, then Gitloc will push translations to your repository and all you have to do is pull changes from it.
If your gitloc.yaml
configured as result: pull-request
, Gitloc will create a new pull request and you will have to review and merge it.
Last updated