New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add locale-specific toUpper/LowerCase #229
Comments
What are you asking for this to do? Is it just roughly the equivalent of |
Yes, that's what we would need, but likely with some Unicode subtleties
that I don't understand.
…On Mon, Feb 5, 2018 at 10:40 AM, Alan Knight ***@***.***> wrote:
What are you asking for this to do? Is it just roughly the equivalent of
aString.split("").map((x) => toBeginningOfSentenceCase(x).join("");
perhaps with the addition of Lithuanian? I've been reluctant to do
anything that would add a large amount of character data, and the urgent
issue seemed to be around these couple of special cases. And you made me
worried so I haven't looked at the OpenJDK version.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#229>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AZC77f8x7SiWlOzOJhKuyA8A6CZreKxdks5tR0sogaJpZM4R5r-v>
.
--
Roberto Scaramuzzi
https://www.google.com/+RobertoScaramuzzi
|
The code above still prints |
toBeginningOfSentenceCase has an optional locale parameter. If you have not set the default locale to 'tr', then you need to pass that parameter. Also, you don't need to do it for each character, you can just do it for the whole string, skipping the split/join. |
If I skip split/join, it does not work since |
It is working fine after setting locale. Thank you. |
Implementing this would be quite involved, see the reference implementation at https://icu.unicode.org/design/case/greek-upper. I would be happy to review PRs, if someone would like to attempt this. |
Currently in our project we need to have separate Intl.messages for messages such as 'Paused' and 'PAUSED' because calling Intl.message('Paused').toUpperCase() might be wrong in some languages, namely Turkish, Azeri and Lithuanian.
This introduces the risk that the two messages might be translated differently, introducing confusion for the user.
Note that Intl has toBeginningOfSentenceCase that handles Turkish and Azeri (but not Lithuanian) so this doesn't seem like such a leap.
See http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/65464a307408/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java
for the OpenJDK implementation (or don't look at it if there are intellectual property issues).
The text was updated successfully, but these errors were encountered: