Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
scripts
mahara-scripts
Commits
fead8592
Commit
fead8592
authored
Apr 06, 2011
by
Richard Mansfield
Browse files
When generating sanitised langpacks, use po file if there's one available in the git repo
parent
1ee1ee41
Changes
2
Show whitespace changes
Inline
Side-by-side
mahara-langpacks/langpacks.sh
View file @
fead8592
...
...
@@ -63,7 +63,7 @@ for lang in ${langs} ; do
git fetch
--quiet
for
remotebranch
in
`
git branch
-r
|
grep
-v
"HEAD
\|
1.
0
_STABLE
\|
1.
1
_STABLE"
`
;
do
for
remotebranch
in
`
git branch
-r
|
grep
-v
"HEAD
"
|
grep
"origin
\/\(
master
\|
1.
2
_STABLE
\|
1.
3
_STABLE
\)
$
"
`
;
do
remotecommit
=
`
git log
--pretty
=
format:
"%H %ai %an"
${
remotebranch
}
|
head
-1
`
...
...
@@ -96,19 +96,47 @@ for lang in ${langs} ; do
git reset
--hard
-q
${
remotebranch
}
fi
dirtybranchdir
=
${
dirtylangdir
}
/
${
localbranch
}
errors
=
0
cleanbranchdir
=
${
cleanlangdir
}
/
${
localbranch
}
[
!
-d
${
dirtybranchdir
}
]
&&
mkdir
${
dirtybranchdir
}
[
-d
${
cleanbranchdir
}
/lang
]
&&
rm
-fr
${
cleanbranchdir
}
[
!
-d
${
cleanbranchdir
}
]
&&
mkdir
${
cleanbranchdir
}
pofile
=
"
${
gitlangdir
}
/
${
lang
}
-
${
localbranch
}
.po"
if
[
-f
$pofile
]
;
then
echo
"
$lang
$localbranch
: using .po file"
# Check utf8ness of .po file?
output
=
`
${
UTF8CMD
}
${
pofile
}
`
if
[
$?
-ne
0
]
;
then
echo
${
pofile
}
>>
${
log
}
echo
-e
"
${
output
}
"
>>
${
log
}
errors
=
1
fi
# Create langpack from .po file
output
=
`
/usr/bin/perl
${
SCRIPTS
}
/po-php.pl
$pofile
$cleanbranchdir
"
${
lang
}
.utf8"
`
if
[
$?
-ne
0
]
;
then
echo
"Failed to create langpack from .po file
${
pofile
}
"
>>
${
log
}
echo
${
pofile
}
>>
${
log
}
echo
-e
"
${
output
}
"
>>
${
log
}
errors
=
1
fi
else
echo
"
$lang
$localbranch
: sanitising"
# sanitise langpack
dirtybranchdir
=
${
dirtylangdir
}
/
${
localbranch
}
[
!
-d
${
dirtybranchdir
}
]
&&
mkdir
${
dirtybranchdir
}
cp
-r
${
gitlangdir
}
/[^
\\
.]
*
${
dirtybranchdir
}
# Clean out stray php from the langpacks
${
CLEANCMD
}
${
dirtybranchdir
}
${
cleanbranchdir
}
errors
=
0
cd
${
DATA
}
diff
-Bwr
${
dirtybranchdir
}
${
cleanbranchdir
}
>
${
diff
}
...
...
@@ -132,6 +160,7 @@ for lang in ${langs} ; do
errors
=
1
fi
done
fi
if
[
$errors
=
0
]
;
then
strip
=
`
echo
${
cleanbranchdir
}
|
sed
's,^/,,'
`
...
...
mahara-langpacks/php-po.php
View file @
fead8592
...
...
@@ -203,3 +203,5 @@ if (!empty($sourcefiles)) {
}
}
}
file_put_contents
(
$destfile
,
"
\n
"
,
FILE_APPEND
);
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment