cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cordova Wiki] Trivial Update of "CordovaTranslations" by ldeluca
Date Tue, 10 Sep 2013 14:46:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cordova Wiki" for change notification.

The "CordovaTranslations" page has been changed by ldeluca:
https://wiki.apache.org/cordova/CordovaTranslations?action=diff&rev1=36&rev2=37

  The github-crowdin.sh script is the script that is run to initiate the translation flow.
 It is a custom script that first pushes any of the changed markdown files into crowdin. 
It then searches through all of the languages from crowdin and downloads only those languages
that are 100% translated.  Finally, it pushes the translated language files back into github.
  
  {{{
+ #!/bin/bash
+ DOMAIN_NAME='http://api.crowdin.net'
  
+ #---CHANGE THE VARIABLES BELOW---
+ GIT_REPO_PATH=/home/<username>/git/cordova-docs
+ CROWDIN_CLI_PATH=/path/to/crowdincli
+ PROJECT_IDENTIFIER='cordova'
+ PROJECT_KEY='___________same API key as above________'
+ 
+ #---
+ 
+ cd $GIT_REPO_PATH
+ git pull origin master
+ git push origin
+ 
+ cd $CROWDIN_CLI_PATH
+ 
+ java -jar crowdin-cli.jar upload sources
+ 
+ curl $DOMAIN_NAME/api/project/$PROJECT_IDENTIFIER/status?key=$PROJECT_KEY > result.xml
+ 
+ read_dom () {
+     local IFS=\>
+     read -d \< ENTITY CONTENT
+ }
+ 
+ while read_dom; do
+       if [[ $ENTITY = "code" ]] ; then
+ 	code=( "${code[@]}" "$CONTENT" )
+       fi
+       if [[ $ENTITY = "translated_progress" ]] ; then
+ 	progress=( "${progress[@]}" "$CONTENT" )
+       fi
+ done < result.xml
+ 
+ for (( i = 0; i < ${#progress[@]}; i++ )); do
+    if [ "${progress[$i]}" = "100" ]; then
+       index=( "${index[@]}" "$i" )
+    fi
+ done
+ 
+ for element in "${index[@]}"; do
+     java -jar crowdin-cli.jar download -l ${code[$element]}
+ done
+ 
+ # fix crowdin issues:
+ echo "About to fix crowdin errors with resulting files"
+ find /home/<username>/git/cordova-docs/docs -name \*.md -exec sed -i "s/\* \* \*/---/1"
{} \; 
+ find /home/<username>/git/cordova-docs/docs -name \*.md -exec sed -i "s/## under the
License./   under the License.\n---/g" {} \;
+ echo "Done with crowdin fix"
+ 
+ cd $GIT_REPO_PATH
+   git add .
+   git commit -m 'Synchronization with Crowdin'
+   git push origin
  }}}
  === Script output ===
  The script will print out the name of each file being downloaded

Mime
View raw message