IMPORTANT : After translation, add your name to Your names
(NAME OF TRANSLATORS
) and email to Your emails
. If there already exist a value, add yours after a comma. Example :
ശ്യാം കൃഷ്ണന് സി.ആര്.,സുബിന് സിബി
shyam@example.com,subin@example.com
There are 3 repos :
We need to make the intermediary repo and then setup Weblate.
Weblate will work with the intermediary repo, and we'll have to manually merge the intermediary repo with KDE upstream (not that much of difficulty).
If your language team is not using Summit, use it. Instructions here.
Using summit helps you to maintain only one branch for both trunk and stable.
We need to create a new git repo which will act as an intermediary between KDE upstream repo (SVN) and Weblate.
Weblate will use this intermediary git repo for syncing.
The intermediary repo after the setup will have this folder structure :
Make the upstream directory structure :
mkdir upstream upstream/summit
cd upstream/summit
svn co svn+ssh://svn@svn.kde.org/home/kde/trunk/l10n-support/ml/summit/messages ml
svn co svn+ssh://svn@svn.kde.org/home/kde/trunk/l10n-support/templates/summit/messages templates
Then, make the folder pos
in the root, and copy files from upstream/summit
folder with the exact sub-directory structure. For example, if you want to add Dolphin file manager (dolphin
), then :
mkdir pos pos/ml pos/ml/dolphin
cp "upstream/summit/ml/dolphin/*" "pos/ml/dolphin/"
Copy file from upstream to corresponding one in pos
folder.
Then import from git to weblate (the command in the Importing components to Weblate section) :
weblate import_project ...
To search for a particular string, do this in upstream :
grep -rnw '.' --include="*.po" -e '"Open Path"'
sudo apt install libpq-dev # https://stackoverflow.com/a/12037133/1372424
sudo apt install libacl1-dev
export PIPENV_VENV_IN_PROJECT=1
pipenv install
.env
:
cp .env.example .env
Edit the new .env
and set a Django secret key, database credentials and optional other fetures.
pipenv shell
ln -s $(realpath settings.py) .venv/lib/python3.6/site-packages/weblate/settings.py
sudo apt install redis-server
.venv/lib/python3.6/site-packages/weblate/examples/celery start
weblate createsuperuser
(n != 1)
back everytime and that's a waste of git & svn storage. Relevant
psql
UPDATE lang_plural SET formula='(n != 1)' WHERE formula='n != 1'
Each PO file will be a component in Weblate. These components will be under a project in Webalte. dolphin
, discover
, plasma-workspace
will each have their own project.
For example, let's take 'dolphin' :
dolphin
using Weblate web interfacedolphin
project :
weblate import_project dolphin 'git@github.com:FOSSersVAST/kde-pos.git' master "pos/(?P<language>[^/]*)/dolphin/(?P<component>[^%]*)\.po"
psql
UPDATE trans_component SET license='Under the same license as the package', new_lang='none';
Your names
and Your emails
strings)
weblate shell -c 'from weblate.trans.models import Component; Component.objects.all().update(suggestion_voting=True, suggestion_autoaccept=3, allow_translation_propagation=False)'
.venv/lib/python3.8/site-packages/weblate/examples/celery restart
weblate loadpo dolphin
Optional :
Enable Reviews: Special reviewer users can be assigned to accept suggestions and mark strings reviewed. This setting is per project available in Settings -> Workflow.
Make project suggestion-review based. Go to Weblate, project page -> Users :
With this, you will have to specifically allow users to submit suggestions. Registered users can't submit suggestions by default.
Or you can just disable public registration and allow specific users only.
.env
:
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=''
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=''
This is done in 2 processes (see the diagram at the end) :
Weblate Sync Process :
Go to Weblate web interface -> Repository Maintenance. Click Commit
& Push
buttons, one after the other.
If there's any merge conflict, fix it in the repo on server. The git folder on repo will be at data/vcs/<name>
. After fixing it, do a git pull
to make sure everything's alright. And repeat this step (do Pull changes on Webalte, commit & push).
Do a git pull
in the intermediary repo
Run
copy-to-upstream.sh
This will copy new localized strings from the recently pushed Weblate changes to KDE upstream summit repo. Note that Weblate PO files have line wrapping enabled, but summit POs does not.
In upstream/summit/ml
folder, commit :
svn commit -m 'Updates from Weblate'
See SVN tips
Merge Process :
In maintainer's local summit setup, do : (More details here)
export KDEREPO=$(realpath .)
export PATH=$KDEREPO/trunk/l10n-support/pology/bin:$PATH
cd $KDEREPO
svn update
cd $KDEREPO/trunk/l10n-support
posummit scripts/messages.summit ml merge
# Decide whether to scatter now or not. Scatter is usually done before a release
posummit scripts/messages.summit ml scatter
svn commit $KDEREPO/trunk/l10n-support/ml $KDEREPO/branches/stable/ $KDEREPO/trunk/l10n-kf5/ml -m 'Routine Merge & Scatter'
In intermediary repo, do (this only need to be done if posummit merge
was done in the previous step.)
cd upstream/summit/templates && svn update && cd -
cd upstream/summit/ml && svn update
Merge strings from files in upstream/summit
folder to pos
copy-from-upstream.sh
The script will only merge strings of files that exists in upstream/summit
and pos
folder. Note that Weblate PO files have line wrapping enabled, but summit POs does not.
Commit & push
git commit -a -m "Sync with KDE Upstream"
git push
Go to Weblate web interface -> Repository Maintenance and Pull.
Steps till Weblate pull changes can be done periodically to keep Weblate POs up-to-date with upstream.
Better add a webhook in GitHub to Weblate so that Weblate is known of the changes automatically. Do this with the weblate
branch.
upstream
folder. If doing so, make sure to update the PO file in the pos
folder too.If you see a ?
next to files when doing svn status
, then those files are untracked. You can track them all with :
# ? means file is new
# You may wanna add new files too (this is the equivalent of git add --all) :
svn status | grep '?' | sed 's/^.* /svn add /' | bash
To revert local changes (git checkout
) :
svn revert --recursive path