From ab23b54c8ae96fb1342abeaa54e10f1f37ae61c9 Mon Sep 17 00:00:00 2001 From: "Gergely Daroczi (@daroczig)" Date: Thu, 14 Dec 2023 15:13:25 +0100 Subject: [PATCH 1/8] po3way install --- web/Weblate-server.qmd | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index 8edc511..c8fc5cd 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -154,7 +154,8 @@ To submit a patch file on the translations found in Weblate but not in the trunk old_files <- po_files() set_branch('main') - added_files <- setdiff(new_files, old_files) + added_files <- setdiff(new_files, old_files) + for (f in added_files) { if (fread(cmd = paste('pocount --csv', f), sep = ',', fill = TRUE)$`Translated Messages` == 0) { log_info('dropping empty {f}') @@ -217,6 +218,12 @@ Weblate will provide a suggestion on how to fix, but in short: cd app/data/vcs/r-project/base-r-gui ``` + When looking for this folder outside of Docker, you can find it at + + ``` + /var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui + ``` + 4. Pull from SVN and start the rebase process to see the actual errors: ```sh @@ -224,7 +231,35 @@ Weblate will provide a suggestion on how to fix, but in short: git svn rebase ``` -5. Resolve the conflict via a text editor, then continue. Let's say `src/library/base/po/es.po` is affected: +5. Optionally, if not yet done, install [helpers](https://github.com/JulienPalard/po3way) to make it easier to deal with the git conflicts (inside Docker): + + ```sh + pip install po3way + ``` + + Then add this folder to `$PATH` or symlink it, e.g. starting Docker as root: + + + ```sh + $ sudo docker exec -u root -ti weblate-docker_weblate_1 bash + # ln -s /home/weblate/.local/bin/po3way /bin/po3way + ``` + + With the regular `weblate` user inside Docker, edit `.git/config` at `app/data/vcs/r-project/base-r-gui` to add: + + ```sh + [merge "po3way"] + name = po file merge driver + driver = po3way --git-merge-driver -- %A %O %B + ``` + + Also edit `.gitattributes` to include: + + ```sh + *.po merge=po3way + ``` + +6. Resolve the conflict via a text editor, then continue. Let's say `src/library/base/po/es.po` is affected: ```sh mcedit src/library/base/po/es.po From ad2a8e21fe91649203d1ad0e3f28b5a5bc3d125a Mon Sep 17 00:00:00 2001 From: "Gergely Daroczi (@daroczig)" Date: Thu, 14 Dec 2023 15:13:35 +0100 Subject: [PATCH 2/8] note where to run git/mcedit/etc --- web/Weblate-server.qmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index c8fc5cd..e7c89c8 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -268,6 +268,8 @@ Weblate will provide a suggestion on how to fix, but in short: git rebase --continue ``` + I usually do the `git` commands inside Docker (at `app/data/vcs/r-project/base-r-gui`), and the edits outside of Docker (at `/var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui`) as it's more comfortable, but feel free to install anything that makes your life easier even within Docker (see e.g. `po3way` above). + To see the current progress of conflict resolution, run something like: ```sh From a73d9036e4f722b98946eba364fcc04c772af1a7 Mon Sep 17 00:00:00 2001 From: "Gergely Daroczi (@daroczig)" Date: Thu, 14 Dec 2023 15:17:01 +0100 Subject: [PATCH 3/8] note backup --- web/Weblate-server.qmd | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index e7c89c8..c4d61ab 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -206,13 +206,20 @@ rebase refs/remotes/origin/trunk: command returned error: 1 Weblate will provide a suggestion on how to fix, but in short: 1. SSH to the Weblate server -2. Attach the Docker container: +2. Make a backup on the Git repo before messing with the rebase process: + + ```sh + tar -zcvf /root/base-r-gui-repo-$(date '+%Y-%m-%d').tar.gz \ + /var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui + ``` + +3. Attach the Docker container: ```sh sudo docker exec -ti weblate-docker_weblate_1 bash ``` -3. Enter the git folder: +4. Enter the git folder: ```sh cd app/data/vcs/r-project/base-r-gui @@ -224,14 +231,14 @@ Weblate will provide a suggestion on how to fix, but in short: /var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui ``` -4. Pull from SVN and start the rebase process to see the actual errors: +5. Pull from SVN and start the rebase process to see the actual errors: ```sh git svn fetch git svn rebase ``` -5. Optionally, if not yet done, install [helpers](https://github.com/JulienPalard/po3way) to make it easier to deal with the git conflicts (inside Docker): +6. Optionally, if not yet done, install [helpers](https://github.com/JulienPalard/po3way) to make it easier to deal with the git conflicts (inside Docker): ```sh pip install po3way @@ -259,7 +266,7 @@ Weblate will provide a suggestion on how to fix, but in short: *.po merge=po3way ``` -6. Resolve the conflict via a text editor, then continue. Let's say `src/library/base/po/es.po` is affected: +7. Resolve the conflict via a text editor, then continue. Let's say `src/library/base/po/es.po` is affected: ```sh mcedit src/library/base/po/es.po From 3d0ea0fdb52137e467aee73553c619bd66b78822 Mon Sep 17 00:00:00 2001 From: "Gergely Daroczi (@daroczig)" Date: Thu, 14 Dec 2023 17:41:16 +0100 Subject: [PATCH 4/8] review clarifications --- web/Weblate-server.qmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index c4d61ab..e5c305e 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -264,6 +264,7 @@ Weblate will provide a suggestion on how to fix, but in short: ```sh *.po merge=po3way + *.pot merge=po3way ``` 7. Resolve the conflict via a text editor, then continue. Let's say `src/library/base/po/es.po` is affected: @@ -275,7 +276,7 @@ Weblate will provide a suggestion on how to fix, but in short: git rebase --continue ``` - I usually do the `git` commands inside Docker (at `app/data/vcs/r-project/base-r-gui`), and the edits outside of Docker (at `/var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui`) as it's more comfortable, but feel free to install anything that makes your life easier even within Docker (see e.g. `po3way` above). + I usually do the `git` commands inside Docker (at `app/data/vcs/r-project/base-r-gui`), and the edits outside of Docker (at `/var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui`) as it's more comfortable, but feel free to install anything that makes your life easier even within Docker (see e.g. the installation steps for `po3way` above on how to become root). To see the current progress of conflict resolution, run something like: From c96b0e5a42cc57ae39b3fae878e57c940695580b Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 14 Dec 2023 19:32:29 -0800 Subject: [PATCH 5/8] Update web/Weblate-server.qmd --- web/Weblate-server.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index e5c305e..173583f 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -213,7 +213,7 @@ Weblate will provide a suggestion on how to fix, but in short: /var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui ``` -3. Attach the Docker container: +3. Attach the Docker container (this image is offered by `weblate`): ```sh sudo docker exec -ti weblate-docker_weblate_1 bash From 4843e82ec60cc46790e52deb180459f6109dae6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20Dar=C3=B3czi?= Date: Fri, 15 Dec 2023 11:18:36 +0100 Subject: [PATCH 6/8] Apply suggestions from code review Co-authored-by: Michael Chirico --- web/Weblate-server.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index 173583f..0316b85 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -244,7 +244,7 @@ Weblate will provide a suggestion on how to fix, but in short: pip install po3way ``` - Then add this folder to `$PATH` or symlink it, e.g. starting Docker as root: + Then add `/home/weblate/.local/bin` to `$PATH` or symlink it, e.g. starting Docker as root: ```sh @@ -252,7 +252,7 @@ Weblate will provide a suggestion on how to fix, but in short: # ln -s /home/weblate/.local/bin/po3way /bin/po3way ``` - With the regular `weblate` user inside Docker, edit `.git/config` at `app/data/vcs/r-project/base-r-gui` to add: + With the regular `weblate` user (i.e., no longer as `root`) inside Docker, edit `.git/config` inside `app/data/vcs/r-project/base-r-gui` to add: ```sh [merge "po3way"] From b5470b186183e089f65b5a37d6f317630cbd4d67 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 17 Dec 2023 22:36:16 -0800 Subject: [PATCH 7/8] emphasize --- web/Weblate-server.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index 0316b85..f810f81 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -225,7 +225,7 @@ Weblate will provide a suggestion on how to fix, but in short: cd app/data/vcs/r-project/base-r-gui ``` - When looking for this folder outside of Docker, you can find it at + As noted above when we made a copy of the repo, this folder can also be found in Weblate outside Docker: ``` /var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui From d0d77a652f36442face6cffd27575a331f6519a1 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 17 Dec 2023 22:38:07 -0800 Subject: [PATCH 8/8] Clarify about installing --- web/Weblate-server.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Weblate-server.qmd b/web/Weblate-server.qmd index f810f81..0d8dee9 100644 --- a/web/Weblate-server.qmd +++ b/web/Weblate-server.qmd @@ -238,7 +238,7 @@ Weblate will provide a suggestion on how to fix, but in short: git svn rebase ``` -6. Optionally, if not yet done, install [helpers](https://github.com/JulienPalard/po3way) to make it easier to deal with the git conflicts (inside Docker): +6. Optionally, you might need to install [helpers](https://github.com/JulienPalard/po3way) to make it easier to deal with the git conflicts (inside Docker): ```sh pip install po3way