Welcome to mirror list, hosted at ThFree Co, Russian Federation.

add_new_language.sh « locale « ui - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b20ef50bba6d81eb8837f51f86b8cbca6bbc580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

function run
{
	local workdir=$(realpath $(dirname $0))
	local potfile=${workdir}/en/LC_MESSAGES/frontend.pot

	[[ -n "$1" ]] ||
		die "specify language code!"

	local pofile=${workdir}/$1/LC_MESSAGES/frontend.po
	[[ -f $pofile  ]] &&
		die "$pofile already exists"

	if [[ -f $potfile ]]; then
		mkdir -p $(dirname $pofile)
		msginit --no-translator --no-wrap --locale=$1 --input=$potfile -o $pofile || die
		git add $pofile || die
	else
		die "po template $potfile missing"
	fi
}

function die
{
	[[ -n "$@" ]] && >&2 echo -e "$@"
	exit 1
}

run "$@"