mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Change titlecase to use 'Mac' processing only when language is a variant of English
This commit is contained in:
		
							parent
							
								
									f997a54203
								
							
						
					
					
						commit
						edfb376516
					
				@ -10,6 +10,7 @@ License: http://www.opensource.org/licenses/mit-license.php
 | 
				
			|||||||
import re
 | 
					import re
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from calibre.utils.icu import capitalize
 | 
					from calibre.utils.icu import capitalize
 | 
				
			||||||
 | 
					from calibre.utils.config import prefs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__all__ = ['titlecase']
 | 
					__all__ = ['titlecase']
 | 
				
			||||||
__version__ = '0.5'
 | 
					__version__ = '0.5'
 | 
				
			||||||
@ -67,11 +68,12 @@ def titlecase(text):
 | 
				
			|||||||
            line.append(icu_lower(word))
 | 
					            line.append(icu_lower(word))
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        match = MAC_MC.match(word)
 | 
					        if prefs['language'].startswith('en'):
 | 
				
			||||||
        if match and not match.group(2)[:3] in ('hin', 'ht'):
 | 
					            match = MAC_MC.match(word)
 | 
				
			||||||
            line.append("%s%s" % (capitalize(match.group(1)),
 | 
					            if match and not match.group(2)[:3] in ('hin', 'ht'):
 | 
				
			||||||
                                  capitalize(match.group(2))))
 | 
					                line.append("%s%s" % (capitalize(match.group(1)),
 | 
				
			||||||
            continue
 | 
					                                      capitalize(match.group(2))))
 | 
				
			||||||
 | 
					                continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        hyphenated = []
 | 
					        hyphenated = []
 | 
				
			||||||
        for item in word.split('-'):
 | 
					        for item in word.split('-'):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user