[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    l10n-support/ca/scripts
From:       Antoni Bella PĂ©rez <null () kde ! org>
Date:       2018-06-30 17:57:34
Message-ID: E1fZK7q-00039I-08 () code ! kde ! org
[Download RAW message or body]

SVN commit 1518974 by bellaperez:

Catalan works
  -- Improves (error output, checks ...) and, with all features what a translator \
expect ;-)

 M  +31 -31    doc_parse_dates.sh  


--- trunk/l10n-support/ca/scripts/doc_parse_dates.sh #1518973:1518974
@@ -7,13 +7,13 @@
 
 CGITREPO="https://cgit.kde.org"
 
-#  [program]
 exit_output() {
-  echo -e "$(basename $0) [--removed] <lang_subdir> [ all | <module_name> ]
+  [ ! "$2" ] || echo -e "$2"
+  echo -e "$(basename $0) [--removed] <lang_subdir> [ all | <module_name> [program] \
]  
  Option:
  --removed                * Only search no longer exsist screenshots
-                          * (dates will not be checked)
+                            (dates will not be checked)
 
  Parameters:
  <lang_subdir>            * Your language code
@@ -20,7 +20,6 @@
  all                      * Parse all screenshots
  <module_name> [program]  * Parse all screenshots into module or
                             program (inside the module)
-                            Note: [program] soon
 
  Function:
  - You need to have 'lang_subdir', of course
@@ -32,16 +31,15 @@
    * If you have an index.docbook, check for screenshots:
      - Check dates with Git, highlighting the result and show all on a table
    * Check if any screenshot is no longer in the origin:
-     - If any, the result will be displayed in a table (if any)
+     - If any, the result will be displayed in a table
 
  Examples:
   $ $(basename $0) ca all
   $ $(basename $0) ca extragear-edu
-
-  or
-  $ $(basename $0) --removed ca extragear-edu\n"
-#   $ $(basename $0) ca applications dolphin"
-#   $ $(basename $0) --removed ca applications kcontrol5/performance\n"
+  $ $(basename $0) ca applications dolphin\n
+  or\n
+  $ $(basename $0) --removed ca applications kcontrol5
+  $ $(basename $0) --removed ca applications kcontrol5/performance\n"
   exit $1
 }
 
@@ -53,15 +51,11 @@
 
 # Server disponibility check
 if [ $(ping -c 1 -4 $CGITREPO &> /dev/null) ]; then
-    echo -e "\nUnable make ping to '$CGITREPO' server! It will end.\n"
-    exit 1
+    exit_output 1 "\nUnable make ping to '$CGITREPO' server! It will end.\n"
   else
     echo -e "ping -c 1 -4 $CGITREPO: OK!\n"
 fi
 
-LANGCODE="$1" # 'ca' code for Catalan
-[ -d $LANGCODE ] || echo -e "\e[1;39mWARNING: \
\"\e[0m\e[1;34m$LANGCODE\e[0m\e[1;39m\" folder (language code) does not exist! \
                \e[0m\n" ; exit_output 1
-
 found_ss() { ls documentation/$MODULE/$DOCDIR/{*.jpg,*.png} 2>/dev/null | head -1; }
 
 app_corrections() {
@@ -69,8 +63,8 @@
     DOCDIR0="$(dirname $docdir | cut -f 4 -d'/')"       # kioslave, kcontrol, \
kcontrol5 or kioslave5  DOCDIR=$(basename $docdir)                          # \
keditbookmarks  if [ -n $MODULE0 ];then
-        [ "$MODULE" != "$MODULE0" ] && read -p "$(echo -e "# \
\"\e[1;34m$MODULE\e[0m\" module will be parsed:") Are you sure? Y/y or N/n: " && [[ \
                $REPLY =~ ^[Nn]$ ]] && exit_output 0
-        echo
+        [ ! $application ] && MESSAGE="$1/$MODULE\e[0m\" module" || \
MESSAGE="$1\e[0m\" application/s" +        [ "$MODULE" != "$MODULE0" ] && read -p \
"$(echo -e "# \"\e[1;34m$MESSAGE will be parsed:") Are you sure? Y/y or N/n: " && [[ \
$REPLY =~ ^[Nn]$ ]] && exit_output 0 "\e[1;39mNOTE: You answered 'No'.\e[0m\n"  fi
     MODULE0="$MODULE"
     MID='1'
@@ -130,16 +124,16 @@
 }
 
 parse_item() {
-    echo -e "** $docdir\n** documentation/$MODULE/$DOCDIR\n-> ($MID) \
$CGITREPO/$GITM.git/tree/$GITD" +    echo -e "** $docdir\n** \
documentation/$MODULE/$DOCDIR\n-> ($MID) $CGITREPO/$GITM.git/tree/$GITD\n"  # Var \
                empty, not parsed
-    [ -z "$GITDIR" ] && continue
+    [ -z "$GITDIR" ] && return
     # Without screenshots, not parsed
-    [ -z $(found_ss) ] && echo -e "\n  \e[1;39m* Without any screenshot.\e[0m\n" && \
continue +    [ -z $(found_ss) ] && echo -e "  \e[1;39m* Without any \
screenshot.\e[0m\n" && return  
     # Translated index.docbook = doc is released
     if [ $(find $docdir/* -type f -name "index.docbook") ]; then
         if [ $removed = '0' ]; then
-            [ -n $(found_ss) ] && echo -e "\n    Screenshot name\t\t\t\t\t Git date  \
SVN date\n  |--------------------------------------------------|---------------|---------------|"
 +            [ -n $(found_ss) ] && echo -e "    Screenshot name\t\t\t\t\t Git date   \
SVN date\n  |--------------------------------------------------|---------------|---------------|"
  # Find item/s into documentation/'module'/'app' local dir
             for screenshot in $(find documentation/$MODULE/$DOCDIR/* -maxdepth 0 \
-type f -name "*.png" -o -name "*.jpg")  do
@@ -176,30 +170,36 @@
   for screenshot in $(ls $docdir/{*.jpg,*.png}  2>/dev/null)
     do
       SCREENSHOT=$(basename $screenshot)
-      [ -f "documentation/$MODULE/$DOCDIR/$SCREENSHOT" ] || \
NOTEXSIST="\e[1;31m$SCREENSHOT\e[0m $NOTEXSIST" +      [ -f \
"documentation/$MODULE/$DOCDIR/$SCREENSHOT" ] || NOTEXSIST="$NOTEXSIST \
\e[1;31m$SCREENSHOT\e[0m"  done
   if [ -n "$NOTEXSIST" ];then
       echo -e "    These screenshot/s no longer exist! Remove it (or rename)"
       echo -e "  |----------------------------------------------------------------------------------|"
                
-      printf "%-85s" "  - $(echo -e "$NOTEXSIST" | sed -e 's/ /, /g' -e 's/, \
$//g')." +      printf "%-85s" "  - $(echo -e "$NOTEXSIST" | sed -e 's/ /, /g' -e \
                's/^, //g')."
       echo -e "\n  |----------------------------------------------------------------------------------|\n"
                
-      NOTEXSIST=""
+      NOTEXSIST=
   fi
 }
 
 folder_search() {
+  [ -d $1 ] || exit_output 1 "\e[1;39mWARNING: \"\e[0m\e[1;34m$1\e[0m\e[1;39m\" \
folder does not exist!\e[0m\n"  # Search folders created with DocBook files that are \
in the repo translations.  for docdir in $(find $1/* -type f -name *.docbook | xargs \
dirname | sort | uniq)  do
-      app_corrections
+      app_corrections $1
       parse_item
     done
 }
 
-MODULE0=""
+LANGCODE="$1" # 'ca' code for Catalan language
+[ -d $LANGCODE ] || exit_output 1 "\e[1;39mWARNING: \
\"\e[0m\e[1;34m$LANGCODE\e[0m\e[1;39m\" folder (language code) does not \
exist!\e[0m\n" +[ ! $1 ] && exit_output 1 "\e[1;39mWARNING: Please, specify you a \
valid <\e[0m\e[1;34mlang_subdir\e[0m\e[1;39m> folder!\e[0m\n" +[ ! $2 ] && \
exit_output 1 "\e[1;39mWARNING: Please, specify you \"\e[0m\e[1;34mall\e[0m\e[1;39m\" \
or <\e[0m\e[1;34mmodule\e[0m\e[1;39m> parameter!\e[0m\n" +
+application=
+MODULE0=
 OPT="$2"
-[[ "$(grep '^module ' scripts/documentation_paths | awk '{print $2}')" = *"$OPT"* ]] \
                && export OPT='module'
-
+[[ "$(grep '^module ' scripts/documentation_paths | awk '{print $2}' | sed -e \
':a;N;$!ba;s/\n/ /g')" = *"$OPT "* ]] && OPT='module'  case $OPT in
   all)
     folder_search $LANGCODE/docs
@@ -207,8 +207,9 @@
   module)
     if [ ! $3 ]; then
         folder_search $LANGCODE/docs/$2
-#       else
-#         folder_search $LANGCODE/docs/$2/$PROGRAM
+      else
+        application='1'
+        folder_search $LANGCODE/docs/$2/$3
     fi
   ;;
   *)
@@ -215,7 +216,6 @@
     exit_output 1
   ;;
 esac
-[ $1 = 0 ] && exit_output 1
 
 exit 0
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic