use better variant to deal with missing entries instead of error suppression to fix...
[authserver.git] / locale / l10n-prepare
CommitLineData
9cab985c
RK
1#!/bin/bash
2
3LOCALEDIR="$( dirname $0 )"
4
5xgettext $LOCALEDIR/../app/*.php* -o kairo_auth.pot -p $LOCALEDIR/en_US/LC_MESSAGES -L PHP --no-location --from-code=utf-8 --foreign-user --package-name="kairo-auth" --package-version="" --copyright-holder="KaiRo.at" --msgid-bugs-address="kairo@kairo.at"
6echo "Strings extracted into kairo_auth.pot."
7
8replace "# SOME DESCRIPTIVE TITLE." "# L10n strings for the KaiRo.at authentication system." \
9 "# Copyright (C) YEAR" "# This Source Code Form is subject to the terms of the Mozilla Public" \
10 "# This file is distributed under the same license as the PACKAGE package." "# License, v. 2.0. If a copy of the MPL was not distributed with this file," \
11 "# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR." "# You can obtain one at http://mozilla.org/MPL/2.0/." \
12 "Language: \\\n" "Language: en_US\\n" -- $LOCALEDIR/en_US/LC_MESSAGES/kairo_auth.pot
13
14for localesub in $LOCALEDIR/*; do
15 if [ -d $localesub ]; then
16 LOCALE="$( basename $localesub )"
17 if [ "$LOCALE" != "en_US" ]; then
18 if [ ! -e "$LOCALEDIR/$LOCALE/LC_MESSAGES" ]; then
19 mkdir $LOCALEDIR/$LOCALE/LC_MESSAGES
20 fi
21 if [ -e "$LOCALEDIR/$LOCALE/LC_MESSAGES/kairo_auth.po" ]; then
22 echo "Merging $LOCALE..."
23 msgmerge $LOCALEDIR/$LOCALE/LC_MESSAGES/kairo_auth.po $LOCALEDIR/en_US/LC_MESSAGES/kairo_auth.pot --update --no-location
24 else
25 echo "Creating $LOCALE as a copy of en_US template..."
26 cp -a $LOCALEDIR/en_US/LC_MESSAGES/kairo_auth.pot $LOCALEDIR/$LOCALE/LC_MESSAGES/kairo_auth.po
27 replace "Language: en_US" "Language: $LOCALE" "MIME-Version: 1.0" "X-Source-Language: en_US" -- $LOCALEDIR/$LOCALE/LC_MESSAGES/kairo_auth.po
28 fi
29 fi
30 fi
31done