~thomas-deruyter-3/qreator/qreator

61.1.16 by David Planella
Simplified internationalization code and made it work with /opt without having to depend on quickly packaging changes
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
### BEGIN LICENSE
3
# Copyright (C) 2012 David Planella <david.planella@ubuntu.com>
4
# This program is free software: you can redistribute it and/or modify it 
5
# under the terms of the GNU General Public License version 3, as published 
6
# by the Free Software Foundation.
7
# 
8
# This program is distributed in the hope that it will be useful, but 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
11
# PURPOSE.  See the GNU General Public License for more details.
12
# 
13
# You should have received a copy of the GNU General Public License along 
14
# with this program.  If not, see <http://www.gnu.org/licenses/>.
15
### END LICENSE
16
17
import os
18
19
TEXTDOMAIN = 'qreator'
20
LOCALEDIR = '/usr/share/locale/'
21
22
import locale
23
from locale import gettext as _
24
25
if os.path.abspath(__file__).startswith('/opt'):
26
    LOCALEDIR = '/opt/extras.ubuntu.com/qreator/share/locale/'
27
28
locale.bindtextdomain(TEXTDOMAIN, LOCALEDIR)
29
locale.bind_textdomain_codeset(TEXTDOMAIN, 'UTF-8')
30
locale.textdomain(TEXTDOMAIN)