Source

Growl / Tools / update_growltunes

#!/bin/sh
###############
#
# Usage: update_growl_from_bundle SOURCE_BUNDLE_PATH LANGUAGE_NAME
#        for example:
#            ~/bin/update_growl_from_bundle Desktop/Growl_French.prefPane French
#
# if LANGUAGE_NAME is "all", all languages will be updated. Note that the
# languages are specified at the bottom of this file.
#
# Set REPO to your Growl repository
#
# To add a new language, the language should first be added in XCode and
# added to the repository with svn add. Then, run the script to copy in
# the localizations.
#
# This script does not cover Growl-WithInstaller.framework or Growl Extras.
################
REPO=~/growl

SOURCE=$1

########
# Functions
########

# Update a nib. First argument is the name of the nib,
# with the .nib extension. Second argument is the destination folder.
# The nib must already exist in the destination.
update_nib()
{
    for file in $1/*.nib ; do
        cp $file $2/$1
    done
}

# Copy all nibs and other files in the current directory to a given destination
loc_copy()
{
    find . '(' -name "*.nib" ')' -prune -execdir cp "{}/classes.nib" "$1/{}" ';' 
    find . '(' -name "*.nib" ')' -prune -execdir cp "{}/keyedobjects.nib" "$1/{}" ';'
    find . '(' -name "*.nib" ')' -prune -execdir cp "{}/objects.xib" "$1/{}" ';' 

    for file in * ; do
        if [ -f  $file ] ; then
            cp $file $1
        fi
    done
}

silent_pushd()
{
    pushd "$1" >/dev/null
}

silent_popd()
{
    popd >/dev/null
}

#####
# Begin!
#####

update_language()
{
    #first parameter to update_language is the language
    LANG=$1.lproj
    
    echo "+++++ Updating $LANG"

    silent_pushd "$SOURCE//Contents/Resources"
    
    # Main resources (PrefPane)
    silent_pushd $LANG
        loc_copy "$REPO/Extras/GrowlTunes/$LANG"
   silent_popd
     silent_popd
}

if [ "$2" = "all" ]  ; then
    for lang in \
        cs \
        French \
        German \
        Japanese \
        Russian \
        zh_CN \
        ; do
            update_language $lang
    done
else
    update_language $2
fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.