'Generates a sort string from title.
Based on trunk title_sort algorithm, but also accommodates series
numbers by padding with leading zeroes to force proper numeric
sorting. Option to sort numbers alphabetically, e.g. \'1942\' sorts
as \'Nineteen forty two\'.
Args:
title (str):
Return:
(str): sort string'

def generate_sort_title(self, title):

    from calibre.ebooks.metadata import title_sort
    from calibre.library.catalogs.utils import NumberToText
    title_words = title_sort(title).split()
    translated = []
    for (i, word) in enumerate(title_words):
        if (i == 0):
            if False:
                translated.append(NumberToText(word).text.capitalize())
            else:
                if re.match('[0-9]+', word[0]):
                    word = word.replace(',', '')
                    suffix = re.search('[\\D]', word)
                    if suffix:
                        word = ('%10.0f%s' % (float(word[:suffix.start()]), word[suffix.start():]))
                    else:
                        word = ('%10.0f' % float(word))
                if (self.letter_or_symbol(word[0]) != word[0]):
                    if ((word[0] > 'A') or (ord('9') < ord(word[0]) < ord('A'))):
                        translated.append('/')
                translated.append(capitalize(word))
        else:
            if re.search('[0-9]+', word[0]):
                word = word.replace(',', '')
                suffix = re.search('[\\D]', word)
                if suffix:
                    word = ('%10.0f%s' % (float(word[:suffix.start()]), word[suffix.start():]))
                else:
                    word = ('%10.0f' % float(word))
            translated.append(word)
    return '    '.join(translated)
