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

Implement missing internationalization related methods #1562

Open
3 of 6 tasks
jedel1043 opened this issue Sep 8, 2021 · 4 comments
Open
3 of 6 tasks

Implement missing internationalization related methods #1562

jedel1043 opened this issue Sep 8, 2021 · 4 comments
Assignees
Labels
builtins PRs and Issues related to builtins/intrinsics E-Medium Medium difficulty problem enhancement New feature or request Intl Changes related to the `Intl` implementation

Comments

@jedel1043
Copy link
Member

jedel1043 commented Sep 8, 2021

Probably follows from #1180.

This is the list of methods we are currently missing from builtin objects because we don't have an internationalization API yet:

String

  • String.prototype.localeCompare()
  • String.prototype.toLocaleLowerCase()
  • String.prototype.toLocaleUpperCase()

Date

  • Date.prototype.toLocaleDateString()
  • Date.prototype.toLocaleTimeString()

General

  • ***.prototype.toLocaleString()

Please comment or edit this issue if you find any other method that depends on internationalization.

@jedel1043 jedel1043 added builtins PRs and Issues related to builtins/intrinsics E-Medium Medium difficulty problem labels Sep 8, 2021
@davimiku
Copy link
Contributor

davimiku commented Sep 8, 2021

Would this also cover the Intl global object and its constructors?

@jedel1043
Copy link
Member Author

Would this also cover the Intl global object and its constructors?

Not really. That would be it's own issue, I think.

@NorbertGarfield
Copy link
Contributor

@jedel1043 I would like to clarify several things about Date.prototype.toLocaleDateString()

  1. Is anybody working to implement this method right now?
  2. Would you mind if I decompose the implementation into several pull requests for sub-tasks like "implement toDateTimeOptions()", "implement BestAvailableLocale()", etc.?
  3. I have found several approaches to get default locale: sys-locale, locale_config, rust_icu to name a few. Which one would you recommend? Or is it better to postpone the actual implementation of "DefaultLocale()" and return some placeholder locale (e.g. "en-US") instead?

@Razican
Copy link
Member

Razican commented Apr 11, 2022

Hi @NorbertGarfield, nobody is working on this right now as far as I can tell, so feel free to work on it.
You can of course decompose the implementation in several pull requests :)

I think the idea here was to use ICU4X to do all this: #1180
About the default locale, you can start by hardcoding a default locale. At some point, we will probably want to leave this to Boa implementers, so that by default we use the system locale in one of those crates, but we let the crate user set a Rust callback to retrieve the locale as they wish.

bors bot pushed a commit that referenced this issue Apr 19, 2022
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This Pull Request provides initial implementation for DateTimeFormat constructor. It relates to #1562.

It changes the following:

- Adds `Intl.DateTimeFormat` property
- Partially implements `DateTimeFormat` constructor (`InitializeDateTimeFormat` step is postponed).
- Introduces `ObjectData::DateTimeFormat`
@bors bors bot closed this as completed in 5a0ff91 May 13, 2022
@raskad raskad reopened this May 13, 2022
Razican added a commit that referenced this issue Jun 8, 2022
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This Pull Request provides initial implementation for DateTimeFormat constructor. It relates to #1562.

It changes the following:

- Adds `Intl.DateTimeFormat` property
- Partially implements `DateTimeFormat` constructor (`InitializeDateTimeFormat` step is postponed).
- Introduces `ObjectData::DateTimeFormat`
Razican pushed a commit that referenced this issue Jun 8, 2022
This Pull Request adds several helpers to resolve #1562.

It adds the following subroutines:

- toDateTimeOptions
- GetOption
- GetNumberOption
- DefaultNumberOption
@jedel1043 jedel1043 added the enhancement New feature or request label Nov 8, 2022
@jedel1043 jedel1043 moved this to To do in Boa pre-v1 Nov 8, 2022
@jedel1043 jedel1043 moved this from To do to In Progress in Boa pre-v1 May 31, 2023
@jedel1043 jedel1043 added the Intl Changes related to the `Intl` implementation label Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics E-Medium Medium difficulty problem enhancement New feature or request Intl Changes related to the `Intl` implementation
Projects
Status: In Progress
5 participants