Skip to content
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

Locale-sensitive operations using U16String and common locale enumeration #2787

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kugelbltz
Copy link
Contributor

This PR works with PR #2773. Operations are prefixed with uni_

Case modification

uni_to_upper, uni_to_lower and uni_to_title operations using ICU operations.

String sorting

  • uni_compare_to : unicode and locale aware string comparison using ICU's collator structure
  • Array[String] sorter (StrSorter)

Formatting

Locale aware time/number to String formatting using ICU's number and time formatter structures

Locale

  • The default locale is now a global variable (default_locale)
  • Added some other common locales in Sys (could be unnecessary)

@Delja Delja requested a review from lbajolet August 22, 2019 14:42

redef class CString
# Returns a null `char *`
new nul `{ return NULL; `}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you define the same property in two places, it might be suitable to move it in a shared class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: is it the right place to define this?


redef class CString
# Returns a null `char *`
new nul `{ return NULL; `}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second definition.

Copy link
Member

@Morriar Morriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have tests and documentation please?

`}

redef class Sys
fun default_locale: String do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be in an object itself added to Sys as to not clutter it more than it already is?

class Locales
	fun chinese_locale: String do return "zh"
	fun english_locale: String do return "en"
	# ...
end

redef class Sys
	fun locales do return new Locales
end

@privat WDYT?


redef class CString
# Returns a null `char *`
new nul `{ return NULL; `}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: is it the right place to define this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants