зеркало из https://github.com/mozilla/pjs.git
Bug 224503 - Create simpler way of localizing ChatZilla
ChatZilla Only. r=samuel
This commit is contained in:
Родитель
a13017892d
Коммит
8e9113c3d1
|
@ -0,0 +1,9 @@
|
|||
chatzilla-@LOCALE@.jar:
|
||||
locale/@LOCALE@/chatzilla/chatzillaOverlay.dtd (xul/locale/@LOCALE@/chatzillaOverlay.dtd)
|
||||
locale/@LOCALE@/chatzilla/browserOverlay.dtd (xul/locale/@LOCALE@/browserOverlay.dtd)
|
||||
locale/@LOCALE@/chatzilla/pref-irc.dtd (xul/locale/@LOCALE@/pref-irc.dtd)
|
||||
locale/@LOCALE@/chatzilla/chatzilla.dtd (xul/locale/@LOCALE@/chatzilla.dtd)
|
||||
locale/@LOCALE@/chatzilla/chatzilla.properties (xul/locale/@LOCALE@/chatzilla.properties)
|
||||
locale/@LOCALE@/chatzilla/config.dtd (xul/locale/@LOCALE@/config.dtd)
|
||||
locale/@LOCALE@/chatzilla/channels.dtd (xul/locale/@LOCALE@/channels.dtd)
|
||||
* locale/@LOCALE@/chatzilla/contents.rdf (xul/locale/@LOCALE@/contents.rdf)
|
|
@ -1,3 +1,4 @@
|
|||
jar-tree
|
||||
xpi-tree
|
||||
xpi-tree-*
|
||||
chatzilla-*.xpi
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
/* NOTE FOR LOCALIZERS:
|
||||
* Copy this file to a new ab-CD subdirectory, where ab-CD is the localization you are doing
|
||||
*
|
||||
* You should edit the following three strings manually if you manipulate an existing jar
|
||||
* If you are building from CVS, please leave them be (but do modify the srDest variable
|
||||
* if necessary.
|
||||
*/
|
||||
var version = "@REVISION@";
|
||||
var locale = "@LOCALE@";
|
||||
var jarFile = "chatzilla-@LOCALE@.jar";
|
||||
// Set this to the size of the jar file you're installing in kibibytes (1024 bytes per KiB)
|
||||
var srDest = 110;
|
||||
// You're done now. Don't modify the rest of the script without a very good reason.
|
||||
|
||||
// this function verifies disk space in kilobytes
|
||||
function verifyDiskSpace(dirPath, spaceRequired)
|
||||
{
|
||||
var spaceAvailable;
|
||||
|
||||
// Get the available disk space on the given path
|
||||
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
|
||||
|
||||
// Convert the available disk space into kilobytes
|
||||
spaceAvailable = parseInt(spaceAvailable / 1024);
|
||||
|
||||
// do the verification
|
||||
if(spaceAvailable < spaceRequired)
|
||||
{
|
||||
logComment("Insufficient disk space: " + dirPath);
|
||||
logComment(" required : " + spaceRequired + " K");
|
||||
logComment(" available: " + spaceAvailable + " K");
|
||||
return(false);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
// this function deletes a file if it exists
|
||||
function deleteThisFile(dirKey, file)
|
||||
{
|
||||
var fFileToDelete;
|
||||
|
||||
fFileToDelete = getFolder(dirKey, file);
|
||||
logComment("File to delete: " + fFileToDelete);
|
||||
if(File.isFile(fFileToDelete))
|
||||
{
|
||||
File.remove(fFileToDelete);
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
return(false);
|
||||
}
|
||||
|
||||
// this function deletes a folder if it exists
|
||||
function deleteThisFolder(dirKey, folder, recursiveDelete)
|
||||
{
|
||||
var fToDelete;
|
||||
|
||||
if(typeof recursiveDelete == "undefined")
|
||||
recursiveDelete = true;
|
||||
|
||||
fToDelete = getFolder(dirKey, folder);
|
||||
logComment("folder to delete: " + fToDelete);
|
||||
if(File.isDirectory(fToDelete))
|
||||
{
|
||||
File.dirRemove(fToDelete, recursiveDelete);
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
return(false);
|
||||
}
|
||||
|
||||
// OS type detection
|
||||
// which platform?
|
||||
function getPlatform()
|
||||
{
|
||||
var platformStr;
|
||||
var platformNode;
|
||||
|
||||
if('platform' in Install)
|
||||
{
|
||||
platformStr = new String(Install.platform);
|
||||
|
||||
if (!platformStr.search(/^Macintosh/))
|
||||
platformNode = 'mac';
|
||||
else if (!platformStr.search(/^Win/))
|
||||
platformNode = 'win';
|
||||
else if (!platformStr.search(/^OS\/2/))
|
||||
platformNode = 'win';
|
||||
else
|
||||
platformNode = 'unix';
|
||||
}
|
||||
else
|
||||
{
|
||||
var fOSMac = getFolder("Mac System");
|
||||
var fOSWin = getFolder("Win System");
|
||||
|
||||
logComment("fOSMac: " + fOSMac);
|
||||
logComment("fOSWin: " + fOSWin);
|
||||
|
||||
if(fOSMac != null)
|
||||
platformNode = 'mac';
|
||||
else if(fOSWin != null)
|
||||
platformNode = 'win';
|
||||
else
|
||||
platformNode = 'unix';
|
||||
}
|
||||
|
||||
return platformNode;
|
||||
}
|
||||
|
||||
var err = initInstall("Chatzilla " + locale + " " + version, "Chatzilla " + locale, version);
|
||||
logComment("initInstall: " + err);
|
||||
|
||||
if (verifyDiskSpace(getFolder("Program"), srDest))
|
||||
{
|
||||
addFile("Chatzilla " + locale + " Locale",
|
||||
"chrome/" + jarFile, // jar source folder
|
||||
getFolder("Chrome"), // target folder
|
||||
""); // target subdir
|
||||
|
||||
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome", jarFile), "locale/" + locale + "/chatzilla/");
|
||||
|
||||
if (err==SUCCESS)
|
||||
performInstall();
|
||||
else
|
||||
cancelInstall(err);
|
||||
}
|
||||
else
|
||||
cancelInstall(INSUFFICIENT_DISK_SPACE);
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<!-- core data -->
|
||||
<!-- NOTES FOR LOCALIZERS
|
||||
If you're using this file, remember to:
|
||||
* Copy this file to a new 'ab-CD' subdirectory, where 'ab-CD' is the
|
||||
localization you are doing. Doing this before modifying anything
|
||||
might be a good idea.
|
||||
* Change the front-end metadata to reflect the names of the translators
|
||||
* Change the following UUID to one you use for this translation only
|
||||
(do NOT use ChatZilla's UUID for this) -->
|
||||
<em:id>{00000000-0000-0000-0000-000000000000}</em:id>
|
||||
<em:version>@REVISION@</em:version>
|
||||
|
||||
<!-- target: Mozilla, version 1.0 to 1.8 -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{86c18b42-e466-45a9-ae7a-9b95ba6f5640}</em:id>
|
||||
<em:minVersion>1.0</em:minVersion>
|
||||
<em:maxVersion>1.8</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- target: Mozilla Firefox, version 0.9 to 1.6 -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>0.9</em:minVersion>
|
||||
<em:maxVersion>1.6</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- front-end metadata -->
|
||||
<em:name>ChatZilla @LOCALE@ localization</em:name>
|
||||
<em:description>ChatZilla Localization.</em:description>
|
||||
<em:creator>Some Localizer</em:creator>
|
||||
<em:contributor>Some Contributor</em:contributor>
|
||||
<em:iconURL>chrome://chatzilla/skin/images/logo.png</em:iconURL>
|
||||
<em:homepageURL>http://my.locale.homepage.com/</em:homepageURL>
|
||||
|
||||
<!-- package files -->
|
||||
<em:file>
|
||||
<Description about="urn:mozilla:extension:file:chatzilla-@LOCALE@.jar">
|
||||
<em:locale>locale/@LOCALE@/chatzilla/</em:locale>
|
||||
</Description>
|
||||
</em:file>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,204 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Set up locale.
|
||||
if [ -z "$LOCALE" ]; then LOCALE=$1; fi
|
||||
|
||||
# Set up paths for finding files.
|
||||
if [ -z "$FEDIR" ]; then FEDIR=$PWD/..; fi
|
||||
if [ -z "$CONFIGDIR" ]; then CONFIGDIR=$FEDIR/../../config; fi
|
||||
if [ -z "$XPILOCALEFILES" ]; then XPILOCALEFILES=$PWD/locale-resources; fi
|
||||
if [ -z "$XPIROOT" ]; then XPIROOT=$PWD/xpi-tree-$LOCALE; fi
|
||||
if [ -z "$JARROOT" ]; then JARROOT=$PWD/jar-tree; fi
|
||||
if [ -z "$PERL" ]; then PERL=perl; fi
|
||||
if [ -z "$DEBUG" ]; then DEBUG=0; fi
|
||||
|
||||
function showParams()
|
||||
{
|
||||
I=0
|
||||
for P in "$@"; do
|
||||
I=$((I+1))
|
||||
echo PARAM $I: "$P"
|
||||
done
|
||||
}
|
||||
|
||||
## Call this with lots of parameters to run a command, log errors, and abort
|
||||
## if it fails. Supports redirection if '>' and '<' are passed as arguments,
|
||||
## e.g.:
|
||||
## safeCommand cmd arg1 arg2 '<' input.file '>' output-file
|
||||
##
|
||||
## Note: only a single input and single output redirection is supported.
|
||||
##
|
||||
function safeCommand()
|
||||
{
|
||||
local -a CMD
|
||||
CMD_COUNT=$((0))
|
||||
INF=""
|
||||
OUTF=""
|
||||
LASTP=""
|
||||
for P in "$@"; do
|
||||
if [ "$LASTP" = "<" ]; then
|
||||
if [ -n "$INF" ]; then
|
||||
echo "ERROR: Multiple input files passed to safeCommand()." >&2
|
||||
exit 2
|
||||
fi
|
||||
INF="$P"
|
||||
elif [ "$LASTP" = ">" ]; then
|
||||
if [ -n "$OUTF" ]; then
|
||||
echo "ERROR: Multiple output files passed to safeCommand()." >&2
|
||||
exit 2
|
||||
fi
|
||||
OUTF="$P"
|
||||
elif [ "$P" = ">" -o "$P" = "<" ]; then
|
||||
echo >/dev/null
|
||||
else
|
||||
CMD[$CMD_COUNT]="$P"
|
||||
CMD_COUNT=$((CMD_COUNT+1))
|
||||
fi
|
||||
LASTP="$P"
|
||||
done
|
||||
|
||||
if [ $DEBUG -gt 0 ]; then
|
||||
echo
|
||||
showParams "${CMD[@]}"
|
||||
echo 'INPUT :' "$INF"
|
||||
echo 'OUTPUT :' "$OUTF"
|
||||
fi
|
||||
|
||||
touch log.stdout log.stderr
|
||||
if [ -z "$INF" -a -z "$OUTF" ]; then
|
||||
"${CMD[@]}" 1>log.stdout 2>log.stderr
|
||||
elif [ -z "$INF" ]; then
|
||||
"${CMD[@]}" 1> "$OUTF" 2>log.stderr
|
||||
elif [ -z "$OUTF" ]; then
|
||||
"${CMD[@]}" < "$INF" 1>log.stdout 2>log.stderr
|
||||
else
|
||||
"${CMD[@]}" < "$INF" 1> "$OUTF" 2>log.stderr
|
||||
fi
|
||||
|
||||
EC=$?
|
||||
if [ $DEBUG -gt 0 ]; then
|
||||
echo 'RESULT :' $EC
|
||||
fi
|
||||
if [ "$EC" != "0" ]; then
|
||||
echo "ERROR ($EC)"
|
||||
cat log.stdout
|
||||
cat log.stderr
|
||||
rm -f log.stdout log.stderr
|
||||
exit 1
|
||||
fi
|
||||
rm -f log.stdout log.stderr
|
||||
return $EC
|
||||
}
|
||||
|
||||
|
||||
## Begin real program ##
|
||||
|
||||
|
||||
if [ "$1" = "clean" ]; then
|
||||
echo -n "Cleaning up files"
|
||||
echo -n .
|
||||
rm -rf "$XPIROOT"
|
||||
echo -n .
|
||||
rm -rf "$JARROOT"
|
||||
echo ". done."
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Check setup.
|
||||
if ! [ -d "$FEDIR" ]; then
|
||||
echo "ERROR: Base ChatZilla directory (FEDIR) not found."
|
||||
exit 1
|
||||
fi
|
||||
if ! [ -d "$CONFIGDIR" ]; then
|
||||
echo "ERROR: mozilla/config directory (CONFIGDIR) not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$LOCALE" ]; then
|
||||
echo "ERROR: You need to provide a locale identifier (ab-CD)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Extract version number.
|
||||
VERSION=`grep "const __cz_version" "$FEDIR/xul/content/static.js" | sed "s|.*\"\([^\"]\{1,\}\)\".*|\1|"`
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "ERROR: Unable to get version number."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Beginning build of $LOCALE locale for ChatZilla $VERSION..."
|
||||
|
||||
|
||||
# Check for existing.
|
||||
if [ -r "chatzilla-$LOCALE-$VERSION.xpi" ]; then
|
||||
echo " WARNING: output XPI will be overwritten."
|
||||
fi
|
||||
|
||||
|
||||
# Check for required directory layouts.
|
||||
echo -n " Checking XPI structure"
|
||||
echo -n .
|
||||
if ! [ -d "xpi-tree-$LOCALE" ]; then mkdir "xpi-tree-$LOCALE"; fi
|
||||
echo -n .
|
||||
if ! [ -d "xpi-tree-$LOCALE/chrome" ]; then mkdir "xpi-tree-$LOCALE/chrome"; fi
|
||||
echo ". done"
|
||||
|
||||
echo -n " Checking JAR structure"
|
||||
echo -n .
|
||||
if ! [ -d jar-tree ]; then mkdir jar-tree; fi
|
||||
echo ". done"
|
||||
|
||||
|
||||
# Make Firefox updates.
|
||||
echo -n " Updating Firefox Extension files"
|
||||
echo -n .
|
||||
safeCommand sed "--expression=s|@REVISION@|$VERSION|g" "--expression=s|@LOCALE@|$LOCALE|g" '<' "$XPILOCALEFILES/$LOCALE/install.rdf" '>' "$XPIROOT/install.rdf"
|
||||
echo -n .
|
||||
echo ". done"
|
||||
|
||||
|
||||
# Make Mozilla Suite updates.
|
||||
echo -n " Updating Mozilla Extension files"
|
||||
echo -n .
|
||||
safeCommand sed "--expression=s|@REVISION@|$VERSION|g" "--expression=s|@LOCALE@|$LOCALE|g" '<' "$XPILOCALEFILES/$LOCALE/install.js" '>' "$XPIROOT/install.js"
|
||||
echo -n .
|
||||
safeCommand mv "$FEDIR/xul/locale/en-US/contents.rdf" "$FEDIR/xul/locale/en-US/contents.rdf.in"
|
||||
safeCommand sed "s|@MOZILLA_VERSION@|cz-$VERSION|g" '<' "$FEDIR/xul/locale/en-US/contents.rdf.in" '>' "$FEDIR/xul/locale/en-US/contents.rdf"
|
||||
safeCommand rm "$FEDIR/xul/locale/en-US/contents.rdf.in"
|
||||
echo ". done"
|
||||
|
||||
|
||||
# Create JAR.
|
||||
echo -n " Constructing JAR package"
|
||||
echo -n .
|
||||
OLDPWD=`pwd`
|
||||
cd "$CONFIGDIR"
|
||||
echo -n .
|
||||
|
||||
safeCommand sed "s|@LOCALE@|$LOCALE|g" '<' "$FEDIR/locale-jar.mn" '>' "$FEDIR/$LOCALE-jar.mn"
|
||||
echo -n .
|
||||
safeCommand $PERL make-jars.pl -v -z zip -p preprocessor.pl -s "$FEDIR" -d "$JARROOT" '<' "$FEDIR/$LOCALE-jar.mn"
|
||||
echo -n .
|
||||
cd "$OLDPWD"
|
||||
echo ". done"
|
||||
|
||||
|
||||
# Make XPI.
|
||||
echo -n " Constructing XPI package"
|
||||
echo -n .
|
||||
safeCommand cp -v "$JARROOT/chatzilla-$LOCALE.jar" "$XPIROOT/chrome/"
|
||||
echo -n .
|
||||
safeCommand chmod 664 "$XPIROOT/chrome/chatzilla-$LOCALE.jar"
|
||||
echo -n .
|
||||
OLDPWD=`pwd`
|
||||
cd "$XPIROOT"
|
||||
safeCommand zip -vr ../chatzilla-$LOCALE-$VERSION.xpi . -i "*" -x log*
|
||||
cd "$OLDPWD"
|
||||
echo ". done"
|
||||
|
||||
|
||||
echo "Build of $LOCALE locale for ChatZilla $VERSION... ALL DONE"
|
|
@ -123,7 +123,7 @@ if [ -z "$VERSION" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo Begining build of ChatZilla $VERSION...
|
||||
echo Beginning build of ChatZilla $VERSION...
|
||||
|
||||
|
||||
# Check for existing.
|
||||
|
@ -213,4 +213,4 @@ cd "$OLDPWD"
|
|||
echo ". done"
|
||||
|
||||
|
||||
echo "Build of ChatZilla $VERSION... ALL DONE"
|
||||
echo "Build of ChatZilla $VERSION... ALL DONE"
|
||||
|
|
Загрузка…
Ссылка в новой задаче