Issue 28900 - I18N: make checkScriptType available via API
Summary: I18N: make checkScriptType available via API
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: thomas.lange
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-07 13:14 UTC by thomas.lange
Modified: 2013-02-24 21:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thomas.lange 2004-05-07 13:14:03 UTC
Please make the mentioned function (or sth that can be used that way) available
via API.

When we implemented Hangul/Hanja conversion you said I should copy that code for
the user dictionaries in order to be able to check the new entries properly for
their scripttype.
This worked fine until lately when you changed the ScriptTypeList due to a bug.
With the change in I18N applied but not for the user dictionary code it was no
longer possible to add words to a Hangul/Hanja user-defined conversion dictionary.

In order to avoid this kind of problem I think it would be nice to have that
function be part of the API or somewhere else in a project that I can link to. I
think svtools would be suitable for the latter. Or maybe there should be a
project like i18nimpl where all the non-API implementations go but that can be
linked with other projects.
That way we wouldn't need a new API for every new tiny thing we may like to have
in the future (e.g. I remember to had use for a function that checks if a
character is a white space in a specified language).
Do you see other solutions for this?

When you have implemented a function that I can call to check the scripttype
please hand this bug to me in order to make the change in my code.
Comment 1 thomas.lange 2004-05-07 13:14:32 UTC
.
Comment 2 karl.hong 2004-05-26 23:12:31 UTC
Karl->TL: ICU provides a function to check script type. Here is what I am going to 
change in checkScriptType(),

#inlcude "unicode/uscript.h"

sal_Int16 SAL_CALL checkScriptType(sal_Unicode c) throw (RuntimeException)
{
  UErrorCode status = U_ZERO_ERROR;

  UScriptCode scriptCode = uscript_getScript(c, &status);

  if ( !U_SUCCESS(status) ) throw RuntimeException();

  return scriptCode == USCRIPT_HANGUL ? SCRIPT_HANGUL : scriptCode == 
USCRIPT_HAN ? SCRIPT_HANJA : SCRIPT_OTHERS;
}

You could link icu library $(ICUUCLIB), which contains uscript_getScript(), 
unicode/uscript.h is exported by icu project.
Comment 3 karl.hong 2004-05-27 18:15:02 UTC
.
Comment 4 thomas.lange 2004-06-01 09:42:35 UTC
.
Comment 5 thomas.lange 2004-06-21 14:39:02 UTC
Fixed in CWS gt08hangulhanja.

Files changed:
linguistic.
- hhconvdic.cxx 1.2.4.2
- makefile.mk 1.13.4.1
Comment 6 thomas.lange 2004-10-29 10:16:47 UTC
TL: OK in CWS gt08hangulhanja
Comment 7 Mathias_Bauer 2007-02-05 15:51:42 UTC
closing
Comment 8 Mathias_Bauer 2007-02-05 15:54:49 UTC
closing