|
1 |
#!/usr/bin/env python |
|
|
2 |
# -*- coding: utf-8 -*- |
3 |
# |
4 |
# Copyright 2016-2017 Univention GmbH |
5 |
# |
6 |
# http://www.univention.de/ |
7 |
# |
8 |
# All rights reserved. |
9 |
# |
10 |
# The source code of this program is made available |
11 |
# under the terms of the GNU Affero General Public License version 3 |
12 |
# (GNU AGPL V3) as published by the Free Software Foundation. |
13 |
# |
14 |
# Binary versions of this program provided by Univention to you as |
15 |
# well as other copyrighted, protected or trademarked materials like |
16 |
# Logos, graphics, fonts, specific documentations and configurations, |
17 |
# cryptographic keys etc. are subject to a license agreement between |
18 |
# you and Univention and not subject to the GNU AGPL V3. |
19 |
# |
20 |
# In the case you use this program under the terms of the GNU AGPL V3, |
21 |
# the program is provided in the hope that it will be useful, |
22 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 |
# GNU Affero General Public License for more details. |
25 |
# |
26 |
# You should have received a copy of the GNU Affero General Public |
27 |
# License with the Debian GNU/Linux or Univention distribution in file |
28 |
# /usr/share/common-licenses/AGPL-3; if not, see |
29 |
# <http://www.gnu.org/licenses/>. |
30 |
|
31 |
import argparse |
32 |
import gettext |
33 |
|
34 |
from univention.config_registry import ConfigRegistry |
35 |
|
36 |
if __name__ == '__main__': |
37 |
parser = argparse.ArgumentParser() |
38 |
parser.add_argument('language_code', |
39 |
type=str, |
40 |
help="two char language code, e.g. 'fr'") |
41 |
args = parser.parse_args() |
42 |
gettext.translation('ucs-school-ucr-l10n', languages=[args.language_code]).install() |
43 |
ucr = ConfigRegistry() |
44 |
ucr.load() |
45 |
overview_ucrvs = {k: v for k, v in ucr.items() if 'ucs/web/overview/entries' in k} |
46 |
ucrvs_translated = {} |
47 |
for ucrv, value in overview_ucrvs.items(): |
48 |
translation = _(value) |
49 |
if not translation == value: |
50 |
ucrvs_translated['{}/{}'.format(ucrv, args.language_code)] = translation |
51 |
ucr.update(ucrvs_translated) |
52 |
ucr.save() |