Check-in [4f189d21eb]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:4f189d21ebe3a15187323f5a965976d350031c8f
Date: 2012-09-26 23:59:49
User: BarryK
Comment:momanager: pinstall.sh: L18L requested if already a translation in .desktop, replace with one from langpack

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/usr/share/doc/langpack-template/pinstall.sh

@@ -4,10 +4,11 @@
 #MoManager will replace the strings TARGETLANG and POSTINSTALLMSG.
 #120315 maybe have hunspell dictionaries in langpack.
 #120830 improved symlinks to hunspell dictionaries.
 #120924 DejaVu font no good for non-Latin languages. 120925 add korean.
 #120926 translate Comment field in .desktop file. note: applications.in now handled in /usr/local/petget/installpkg.sh.
+#120927 L18L requested if there is already a translation in .desktop, remove it, replace with one from langpack.
 
 echo "Post install script for TARGETLANG language pack"
 
 #if [ "$LANG" = "C" ];then #in case caller script did this.
  LANG="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
@@ -21,24 +22,30 @@
   ABASEDESKTOP="`basename $ADESKTOPFILE`"
   ADIRDESKTOP=''
   [ -f usr/share/applications/${ABASEDESKTOP} ] && ADIRDESKTOP='usr/share/applications'
   [ ! "$ADIRDESKTOP" ] && [ -f usr/local/share/applications/${ABASEDESKTOP} ] && ADIRDESKTOP='usr/local/share/applications'
   if [ "$ADIRDESKTOP" ];then
-   if [ "`grep '^Name\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP}`" = "" ];then
-    if [ "`grep '^Name\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP}`" != "" ];then
-     #aaargh, these accursed back-slashes! ....
-     INSERTALINE="`grep '^Name\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
-     sed -i -e "s%^Name=%${INSERTALINE}\\nName=%" ${ADIRDESKTOP}/${ABASEDESKTOP}
+   if [ "`grep '^Name\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP}`" != "" ];then
+    if [ "`grep '^Name\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP}`" != "" ];then
+     #120927 L18L requested if there is already a translation, remove it, replace with one from langpack.
+     grep -v '^Name\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP} > /tmp/momanager-pinstall-sh-desktop
+     mv -f /tmp/momanager-pinstall-sh-desktop ${ADIRDESKTOP}/${ABASEDESKTOP}
     fi
+    #aaargh, these accursed back-slashes! ....
+    INSERTALINE="`grep '^Name\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
+    sed -i -e "s%^Name=%${INSERTALINE}\\nName=%" ${ADIRDESKTOP}/${ABASEDESKTOP}
    fi
    #120926 do same for Comment field...
-   if [ "`grep '^Comment\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP}`" = "" ];then
-    if [ "`grep '^Comment\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP}`" != "" ];then
-     #aaargh, these accursed back-slashes! ....
-     INSERTALINE="`grep '^Comment\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
-     sed -i -e "s%^Comment=%${INSERTALINE}\\nComment=%" ${ADIRDESKTOP}/${ABASEDESKTOP}
+   if [ "`grep '^Comment\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP}`" != "" ];then
+    if [ "`grep '^Comment\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP}`" != "" ];then
+     #120927 L18L requested if there is already a translation, remove it, replace with one from langpack.
+     grep -v '^Comment\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP} > /tmp/momanager-pinstall-sh-desktop
+     mv -f /tmp/momanager-pinstall-sh-desktop ${ADIRDESKTOP}/${ABASEDESKTOP}
     fi
+    #aaargh, these accursed back-slashes! ....
+    INSERTALINE="`grep '^Comment\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
+    sed -i -e "s%^Comment=%${INSERTALINE}\\nComment=%" ${ADIRDESKTOP}/${ABASEDESKTOP}
    fi
   fi
  done
  #rm -r -f usr/share/applications.in
  #...don't remove it. might be useful for ppm when install future packages.