#1015 replace Zanata pull/push by translation repository
Merged 4 years ago by bcotton. Opened 4 years ago by jibecfed.
jibecfed/fedora-websites master  into  master

file modified
+12 -2
@@ -10,6 +10,8 @@ 

  BASEPATH = /

  PWD = $(shell pwd)

  POT_FILE := $(shell ls po/*.pot)

+ TRANS_TMP := $(shell mktemp -d)

+ TRANS_FOLDER := $(basename $(notdir $(POT_FILE)))

  BUILDDIR = $(PWD)/../build.d

  HTTPDDIR = $(PWD)/../httpd

  
@@ -48,10 +50,18 @@ 

  msgmerge: $(wildcard po/*.po)

  

  pushpot:

- 	zanata push $(subst po/,,$(POT_FILE))

+ 	git clone ssh://git@pagure.io/fedora-web/translations.git $(TRANS_TMP)

+ 	cp $(POT_FILE) $(TRANS_TMP)/$(TRANS_FOLDER)/

+ 	cd $(TRANS_TMP) && git add *.pot

+ 	cd $(TRANS_TMP) && git commit -m "update pot file for $(TRANS_FOLDER)"

+ 	cd $(TRANS_TMP) && git push

+ 	rm -rf $(TRANS_TMP)

  

  pullpos:

- 	zanata pull --no-copytrans

+ 	git clone ssh://git@pagure.io/fedora-web/translations.git $(TRANS_TMP)

+ 	cp -R $(TRANS_TMP)/$(TRANS_FOLDER)/*.po ./po/

+ 	cp -R $(TRANS_TMP)/$(TRANS_FOLDER)/LINGUAS ./po/

+ 	rm -rf $(TRANS_TMP)

  

  # Use fedfind to grep all releases for the releases.json file, used by FMW

  # Use this instruction only for getfedora.org

file modified
+4 -1
@@ -17,7 +17,10 @@ 

  submit them here. Check of the [Fedora Websites wiki](https://fedoraproject.org/wiki/Websites#Join_the_Websites_Team) for details on how to

  become a member of the websites team. 

  

- Translations are handled by the Fedora [localization team](https://fedoraproject.org/wiki/L10N) on [Zanata](https://fedora.zanata.org/project/view/fedora-web).

+ Translations are handled by the Fedora [localization team](https://fedoraproject.org/wiki/L10N) on [Fedora Weblate](https://translate.stg.fedoraproject.org/projects/fedora-websites/).

+ 

+ [![Translation status](https://translate.stg.fedoraproject.org/widgets/abrt/-/287x66-white.png)](https://translate.stg.fedoraproject.org/engage/abrt/?utm_source=widget)

+ 

  

  ### Websites

  This repository contains the sources for the following Fedora Websites:

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>alt.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org/</url>

-   <project>fedora-web</project>

-   <project-version>arm.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>boot.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org/</url>

-   <project>fedora-web</project>

-   <project-version>budget.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -145,8 +145,8 @@ 

  * Update Alpha Image sizes and pre_cloud_composedate in ``./build.d/globalvar.py``.

    Verify they are right in Cloud images and Docker image.

  

- * Update the new POT files and push them to Zanata (ask a maintainer to do

-   so) every time you change text strings.

+ * Update the new POT files and push them to translation repository every time

+   you change text strings.

  

  * Add this build to stg.fedoraproject.org (ansible syncStatic.sh.stg) to

    test the pages online.
@@ -222,8 +222,8 @@ 

  * Update Beta Image sizes and pre_cloud_composedate in ``./build.d/globalvar.py``.

    Verify they are right in Cloud images and Docker image.

  

- * Update the new POT files and push them to Zanata (ask a maintainer to do

-   so) every time you change text strings.

+ * Update the new POT files and push them to translation repository every time

+   you change text strings.

  

  * Add this build to stg.fedoraproject.org (ansible syncStatic.sh.stg) to

    test the pages online.
@@ -298,8 +298,8 @@ 

  

  * Update static/js/checksum.js and check if the paths and checksum still match.

  

- * Update the new POT files and push them to Zanata (ask a maintainer to do

-   so) every time you change text strings.

+ * Update the new POT files and push them to translation repository every time

+   you change text strings.

  

  * Add this build to stg.fedoraproject.org (ansible syncStatic.sh.stg) to

    test the pages online.
@@ -351,4 +351,4 @@ 

  

     $ git merge f23-beta

     $ git checkout --theirs f23-beta [list of conflicting po files]

-    $ git commit 

\ No newline at end of file

+    $ git commit

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>fedoracommunity.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>fedorahosted.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org/</url>

-   <project>fedora-web</project>

-   <project-version>flocktofedora.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>getfedora.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org/</url>

-   <project>fedora-web</project>

-   <project-version>iot.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org/</url>

-   <project>fedora-web</project>

-   <project-version>labs.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>spins.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

@@ -1,7 +0,0 @@ 

- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

- <config xmlns="http://zanata.org/namespace/config/">

-   <url>https://fedora.zanata.org</url>

-   <project>fedora-web</project>

-   <project-version>start.fedoraproject.org</project-version>

-   <project-type>gettext</project-type>

- </config>

file modified
+17 -97
@@ -1,5 +1,5 @@ 

  #!/bin/bash

- # this script pull all translations to transifex,

+ # this script pull all translations to tranlation repository,

  #      make an new POT and push it if asked,

  #      and then fill the LINGUAS file

  
@@ -20,28 +20,26 @@ 

  usage: $0 [OPTIONS] [-w WEBSITE_PATH]

  

  This script update all L10n things. Will never git push.

-  * pull translations from transifex against WEBSITE_PATH in current branch

+  * pull translations from translation repository against WEBSITE_PATH in current branch

   * make new POT in WEBSITE_PATH

   * update the LINGUAS file in WEBSITE_PATH

  

  OPTIONS:

     -h      Show this message

-    -a      Git add all

-    -c      With -a, git commit with default message (POs, POT and LINGUAS in different commits)

-    -p      With -c make pushpot (update POT on transifex.net)

+    -p      update POT on tranlation repository

  

  WEBSITE:

      The website targeted (like "fedoraproject.org")

      Without WEBSITE specifyed, will parse the whole website array.

  

  EXAMPLES:

-          $ $0                                     (1)

-          $ $0 -a -w ../spins.fedoraproject.org    (2)

-          $ $0 -a -c -p                            (3)

+          $ $0                                  (1)

+          $ $0 -w ../spins.fedoraproject.org    (2)

+          $ $0 -p                               (3)

  

-    1. Update all but let you git add and push to transifex.net. (Takes time but let you do the job).

-    2. Update POs POT and LINGUAS of spins.fedoraproject.org website. Let you commit and push (git/transifex).

-    3. Update all and commit changes in 3 different commits. That's what you were looking for.

+    1. Update all but let you git add and push to tranlation repository.

+    2. Pull POs + LINGUAS, generate pot of spins.fedoraproject.org website. Let you test localy.

+    3. Pull POs + LINGUAS, generate pot and push it to tranlation repository. That's what you were looking for.

  

  EOF

  }
@@ -53,14 +51,8 @@ 

        usage

        exit 1

        ;;

-     a)

-       ADD=1

-       ;;

-     c)

-       COMMIT=1

-       ;;

      p)

-       TXN_PUSH=1

+       POT_PUSH=1

        ;;

      w)

        WEBSITE=$OPTARG
@@ -95,19 +87,9 @@ 

  do

     cd $i

     make pullpos

-    if [ ! -z $ADD ]

-    then

-      git add po/*.po

-    fi

     cd $root

  done

  

- if [ ! -z $COMMIT ] && [ ! -z $ADD ]

- then

-   git commit -m "[`basename $0`] Full POs update"

- fi

- 

- 

  ### POT

  

  for i in "${site[@]}"
@@ -115,81 +97,19 @@ 

     echo "- Updating $i POT"

     cd $i

     make pot

-    insertion_number=`git diff --numstat po/*.pot 2>&1 | awk '{print $1}'` # record the number of insertion,

- 									 #if no new string found at least the build time could change (i.e. check if > 1)

-    let "$((++insertion_number))"     # cause in case the file is exactly the same, prevent no git diff output

-    if [ $insertion_number -gt 2 ]

-    then								 # POT should be uploaded

-      NEED_COMMIT=1					 # don't commit if any POT modified!

-      if [ ! -z $ADD ]

-      then

-        git add po/*.pot

-        if [ ! -z $TXN_PUSH ] && [ ! -z $COMMIT ]

-        then

-          make pushpot

-        fi

-      fi

+ 

+    # POT should be uploaded

+    if [ ! -z $POT_PUSH ]

+    then

+      make pushpot

       echo "POT updated"

-    else

-        git checkout -- po/*.pot     # no real change, undo (only the build time was changed)

     fi

+ 

     cd $root

  done

  

- if [ ! -z $NEED_COMMIT ] && [ ! -z $COMMIT ] && [ ! -z $ADD ]

- then

-   git commit -m "[`basename $0`] Full POT update"

- fi

- 

  ### LINGUAS

- # update the LINGUAS file by adding all language code where translations have started

- 

- for i in "${site[@]}"

- do

-   echo "- Updating $i LINGUAS file"

-   PO_PATH="$i/po"

-   LINGUAS="$PO_PATH/LINGUAS"

- 

- 

-   if [ ! -f $LINGUAS ]

-   then

-      echo "No $LINGUAS file there"

-   fi

- 

-   tmp="l_tmp"

-   sed -i 's#\s##g' $LINGUAS                   # remove trailing whitespaces

- 

-   for file in `ls $PO_PATH/*.po`

-   do

-     stat=`msgfmt -c --statistics $file 2>&1 | awk '{print $1}'`

-     if [ "$stat" != "0" ]                     # if translation is started

-     then

-       lang=`echo $file| sed -n "s#.*/\(.*\).po#\1#p" `   # filter the language code

-       echo $lang >> $tmp                      # add it in a temp file

-       new=`grep $lang"\$" $LINGUAS`

-       if [ "@$new" == "@" ]                   # if this language code is new

-       then

-         echo "$lang added, translated strings=$stat"

-       fi

-     fi

-   done

- 

-   rm $LINGUAS

-   cat $tmp|sort > $LINGUAS

-   rm $tmp

- 

-   git diff --exit-code $LINGUAS > /dev/null   # check if modified

-   if [ $? -eq  1 ] && [ ! -z $ADD ]

-   then

-     git add $LINGUAS

-     L_COMMIT=1

-   fi

- done

- 

- if [ ! -z $L_COMMIT ] && [ ! -z $COMMIT ] && [ ! -z $ADD ]

- then

-   git commit -m "[`basename $0`] Full LINGUAS update"

- fi

+ # This is now handled in pullpos

  

  

  exit 0

as described in https://pagure.io/fedora-websites/issue/1013 Weblate requires to interact with a separate repository
here is a patch to use this repository instead of Zanata push/pull

this probably isn't the nicest way to write a Makefile, please accept my apologies

2 new commits added

  • we are not using Zanata anymore
  • remove zanata xml files
4 years ago

I don't know what to do with the "syncpos" from makefile as I don't understand where it could be used. I would suggest to delete it.

2 new commits added

  • simplify the l10n generation
  • remove useless ls
4 years ago

5 new commits added

  • simplify the l10n generation
  • remove useless ls
  • we are not using Zanata anymore
  • remove zanata xml files
  • replace Zanata pull/push by translation repository
4 years ago

rebased onto 9b85f2c

4 years ago

Pull-Request has been merged by bcotton

4 years ago