1#
2# Copyright 2007 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 Vietnamese language.
20
21.. seealso:: http://en.wikipedia.org/wiki/Vietnamese_language
22"""
23
24
25from translate.lang import common, fr
26
27
28class vi(common.Common):
29    """This class represents Vietnamese."""
30
31    # Vietnamese uses similar rules for spacing two-part punctuation marks as
32    # French, but does not use a space before '?'.
33    puncdict = {}
34    for c in ":;!#":
35        puncdict[c] = " %s" % c
36
37    @classmethod
38    def punctranslate(cls, text):
39        """Implement some extra features for quotation marks.
40
41        Known shortcomings:
42            - % and $ are not touched yet for fear of variables
43            - Double spaces might be introduced
44        """
45        text = super().punctranslate(text)
46        return fr.guillemets(text)
47
48    mozilla_nplurals = 2
49    mozilla_pluralequation = "n!=1 ? 1 : 0"
50