From edfb376516acd3b58097cf21571a3af9a0957a1c Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sun, 8 May 2011 09:51:46 +0100 Subject: [PATCH] Change titlecase to use 'Mac' processing only when language is a variant of English --- src/calibre/utils/titlecase.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calibre/utils/titlecase.py b/src/calibre/utils/titlecase.py index 1f153dd5fe..285f55f22d 100755 --- a/src/calibre/utils/titlecase.py +++ b/src/calibre/utils/titlecase.py @@ -10,6 +10,7 @@ License: http://www.opensource.org/licenses/mit-license.php import re from calibre.utils.icu import capitalize +from calibre.utils.config import prefs __all__ = ['titlecase'] __version__ = '0.5' @@ -67,11 +68,12 @@ def titlecase(text): line.append(icu_lower(word)) continue - match = MAC_MC.match(word) - if match and not match.group(2)[:3] in ('hin', 'ht'): - line.append("%s%s" % (capitalize(match.group(1)), - capitalize(match.group(2)))) - continue + if prefs['language'].startswith('en'): + match = MAC_MC.match(word) + if match and not match.group(2)[:3] in ('hin', 'ht'): + line.append("%s%s" % (capitalize(match.group(1)), + capitalize(match.group(2)))) + continue hyphenated = [] for item in word.split('-'):