[PUSHED] Re: [PATCH 2/2] Smarter auto-complete capitalization (#i22961#) and i18n handling

Caolán McNamara caolanm at redhat.com
Wed Jun 6 03:44:43 PDT 2012


On Wed, 2012-06-06 at 21:53 +1200, Brad Sowden wrote:
> I just checked and your test case passes when sTest = "Some text" but if 
> I change it to sTest = "Some tExt" it fails (assuming "Some Text" is the 
> right result).

That looks sort of dubious alright. Way too many classes and wrappers
here. Its unclear to me whether that characterclassifcation thing is
intended to just operate on characters and convert all of them to a
given case, in which case its broken for title case since
https://issues.apache.org/ooo/show_bug.cgi?id=30863 or whether its
really supposed to do what it does now, which doesn't make a lot of
sense either.

> The following function appears to do what I originally wanted (i.e. 
> Title case the first character and Lower case subsequent characters) but 
> using opengrok I can't find anywhere that actually instantiates this class.
> 
> rtl::OUString SAL_CALL Transliteration_titlecase::transliterate()

Looks like TransliterationWrapper in unotools is the "route" to that,
e.g. utl::TransliterationWrapper aTrans(factory,
TransliterationModulesExtra::TITLE_CASE);

where the call to the ctor for Transliteration_titlecase is hidden away
inside TransliterationImpl::loadModuleByName. Putting a breakpoint on
Transliteration_titlecase::Transliteration_titlecase and using the
"format->change case->Capitalize Every Word" in writer gives the bt for
it.

Its all the usual overengineered horror :-)

> http://opengrok.libreoffice.org/xref/core/i18npool/source/transliteration/transliteration_body.cxx#329
> 
> Anyway, I think the solution I used in my patch is better as I actually 
> wanted Sentence case rather than Title case for the overall string.

fwiw that utl::TransliterationWrapper has a sentence case mode.

C.



More information about the LibreOffice mailing list