1# 2# Copyright 2007-2009,2011 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 Greek language. 20 21.. seealso:: http://en.wikipedia.org/wiki/Greek_language 22""" 23 24 25import re 26from collections import OrderedDict 27 28from translate.lang import common 29 30 31class el(common.Common): 32 """This class represents Greek.""" 33 34 # Greek uses ; as question mark and the middot instead 35 sentenceend = ".!;…" 36 37 sentencere = re.compile( 38 r""" 39 (?s) # make . also match newlines 40 .*? # anything, but match non-greedy 41 [%s] # the puntuation for sentence ending 42 \s+ # the spacing after the puntuation 43 (?=[^a-zά-ώ\d]) # lookahead that next part starts with caps 44 """ 45 % sentenceend, 46 re.VERBOSE | re.UNICODE, 47 ) 48 49 puncdict = OrderedDict( 50 [ 51 (";", "·"), 52 ("?", ";"), 53 ] 54 ) 55 56 # Valid latin characters for use as accelerators 57 valid_latin_accel = ( 58 "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "1234567890" 59 ) 60 61 # Valid greek characters for use as accelerators (accented characters 62 # and "ς" omitted) 63 valid_greek_accel = "αβγδεζηθικλμνξοπρστυφχψω" "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ" 64 65 # Valid accelerators 66 validaccel = "".join([valid_latin_accel, valid_greek_accel]) 67