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

Intl: Implement supportedLocalesOf for services #3711

Open
5 of 8 tasks
Tracked by #3710
jedel1043 opened this issue Mar 2, 2024 · 10 comments
Open
5 of 8 tasks
Tracked by #3710

Intl: Implement supportedLocalesOf for services #3711

jedel1043 opened this issue Mar 2, 2024 · 10 comments
Labels
blocked Waiting for another code change enhancement New feature or request Intl Changes related to the `Intl` implementation

Comments

@jedel1043 jedel1043 added the Intl Changes related to the `Intl` implementation label Mar 2, 2024
@jedel1043 jedel1043 changed the title Implement supportedLocalesOf for Intl services Intl: Implement supportedLocalesOf for Intl services Mar 2, 2024
@jedel1043 jedel1043 changed the title Intl: Implement supportedLocalesOf for Intl services Intl: Implement supportedLocalesOf for services Mar 2, 2024
@jedel1043 jedel1043 added the enhancement New feature or request label Mar 2, 2024
@radudiaconu0
Copy link

can i work on this?

@jedel1043
Copy link
Member Author

@radudiaconu0 Thank you! Let me assign this to you

@radudiaconu0
Copy link

@jedel1043 i dint study well the source cod. can you guide me to the file where i need to make the changes?

@jedel1043
Copy link
Member Author

jedel1043 commented Sep 3, 2024

@radudiaconu0 Of course!

https://github.com/boa-dev/boa/tree/main/core/engine/src/builtins/intl is the main directory where all the Intl builtins live. Specifically for Intl.Collator, you'd have to go to its impl:

then add a supported_locales_of method that does precisely what the specification does. The spec is fairly flexible so you can differ a bit from it if required. Please also add a comment per line of specification above the Rust code that implements that line, and a doc comment for the method with the "spec function" and a link to the corresponding specification. You can check the other methods if you have questions about the correct format.

After that, you just need to add your new method to the builtin in:

fn init(realm: &Realm) {

and that should be it for Intl.Collator. You can follow the same process for the rest of the Intl builtins.
For testing how many test262 tests are fixed by the new changes, you can either open a PR which will run this process automatically and give a comparative table on the results of the test262 CI job, or you can run the suite locally (cargo run --release --bin boa_tester -- run -o <path to directory>), both in the main branch and in you new feature branch, and then compare the results with

cargo run --release --bin boa_tester -- compare \ 
  <path to main results>/latest.json \
  <path to feature results>/latest.json -m

@radudiaconu0
Copy link

boa/core/engine/src/builtins/intl/collator/mod.rs

so i guess this is not actually working

@jedel1043
Copy link
Member Author

Oh right, we already added it for those. I remember that we left this issue open to remember to add this to builtins that aren't properly implemented yet like DateTimeFormat. I'll add a list with all our current implementations and our missing ones to clarify.

@jedel1043
Copy link
Member Author

@radudiaconu0 I'm very sorry for the confusion! I'll unassign you from this issue and mark it as blocked.

@jedel1043 jedel1043 added the blocked Waiting for another code change label Sep 3, 2024
@radudiaconu0
Copy link

@JavedNissar no problem

what can i do then to help ?

@radudiaconu0
Copy link

image
i woudl liek to contribute here

@jedel1043
Copy link
Member Author

jedel1043 commented Sep 3, 2024

@radudiaconu0 Those are mostly blocked from the icu4x side, so if you want to contribute to the implementation of those, it would be with the icu4x project.

The only things that aren't blocked right now are a prototype of DateTimeFormat without skeletons (only allow dateStyle and timeStyle options), and moving Intl into a separate crate, which requires a bit of decoupling work that could be interesting for you.

If you're interested in the internationalization side, I'd recommend you to check icu4x's good first issues for some contributions you can do.

If you just want to learn about JS engines, you could pick up some issues from our list of good first issues.

However, if you want to learn both, I think the DateTimeFormat is a nice introduction around how to translate 402 spec to Rust code, how to implement builtins and how to use icu4x's components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Waiting for another code change enhancement New feature or request Intl Changes related to the `Intl` implementation
Projects
None yet
Development

No branches or pull requests

2 participants