1#
2# Copyright 2013 Zuza Software Foundation
3#
4# This file is part of translate.
5#
6# translate is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# translate is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, see <http://www.gnu.org/licenses/>.
18
19"""This module represents the N'Ko language.
20
21.. seealso:: http://en.wikipedia.org/wiki/N'Ko_language
22"""
23
24
25import re
26
27from translate.lang import common
28
29
30def reverse_quotes(text):
31    def convertquotation(match):
32        return "”%s“" % match.group(1)
33
34    return re.sub("“([^”]+)”", convertquotation, text)
35
36
37class nqo(common.Common):
38    """This class represents N'Ko."""
39
40    listseperator = "߸ "
41
42    puncdict = {
43        ",": "߸",
44        ";": "؛",
45        "?": "؟",
46        "!": "߹",
47    }
48
49    ignoretests = {
50        "all": ["acronyms", "simplecaps", "startcaps"],
51    }
52
53    @classmethod
54    def punctranslate(cls, text):
55        text = super().punctranslate(text)
56        return reverse_quotes(text)
57