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

Ukrainian language support #19

Merged
merged 20 commits into from
Dec 15, 2023
Merged

Ukrainian language support #19

merged 20 commits into from
Dec 15, 2023

Conversation

pavloslav
Copy link
Contributor

Completed all functions for Ukrainian (currency fractions are still a bit of mess, but it looks like there are like that in the original too)

@Ballasi
Copy link
Owner

Ballasi commented Nov 27, 2023

Hey, I've seen you do a lot of work in here, thanks a lot!

Sorry for the delay -- I was a bit inactive the last few days. I will take a look and answer everything you've been sending tomorrow. Once again, sorry if I wasn't active before, but I will answer everything! Thanks again.

@pavloslav
Copy link
Contributor Author

It's ok, take your time. Just merge it so we can move on.

@Ballasi
Copy link
Owner

Ballasi commented Dec 11, 2023

Hey, sorry for the extended delay, I did an initial review on your commits, can you take a look at them?

Thanks a lot for the contribution, it means a lot :)

src/lang/uk.rs Outdated Show resolved Hide resolved
src/lang/uk.rs Outdated Show resolved Hide resolved
src/lang/uk.rs Outdated Show resolved Hide resolved
src/lang/uk.rs Show resolved Hide resolved
src/lang/uk.rs Outdated Show resolved Hide resolved
src/lang/uk.rs Outdated Show resolved Hide resolved
src/lang/uk.rs Show resolved Hide resolved
src/lang/uk.rs Show resolved Hide resolved
src/lang/uk.rs Show resolved Hide resolved
@pavloslav
Copy link
Contributor Author

Ok, I've closed the most issues. Still, several rustfmt::skip remain; and one more thing: I've added prefer() arguments description, but I think formatting is poor, and probably it should be split moved to specific languages. Any ideas?

src/num2words.rs Outdated
///
/// Gender: **masculine/m/чоловічий/чол/ч**, feminine/f/жіночий/жін/ж, neuter/n/середній/сер/с
///
/// Declenation: **nominative/nom/називний/н**, genitive/gen/родовий/р, dative/dat/давальний/д,
Copy link
Owner

Choose a reason for hiding this comment

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

Declenation => Declination

const ORDINAL_FLEXIONS_PLURAL_SHORT: [&str; 6] = [
"і", "х", "м", "х", "ми", "х",
];
const ORDINAL_FLEXIONS_PLURAL_SHORT: [&str; 6] = ["і", "х", "м", "х", "ми", "х"];

#[rustfmt::skip]
const NOUN_2ST_GROUP_HARD_DECLENSIONS: [[&str; 6]; 2] = [ //долар
Copy link
Owner

Choose a reason for hiding this comment

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

You are using a lot of references to DECLENSIONS here, instead of DECLINATION. For consistency, I believe it would be better to have them be the same everywhere.

This can be easily modified using a sed command: find src -type f -exec sed -i 's/DECLENSIONS/DECLINATIONS/g' {} +

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I often tell myself not to work when it's late… but that's the only way to work on side projects.

src/lang/uk.rs Outdated
NOUN_2ST_GROUP_HARD_DECLENSIONS[number_idx][declination_idx]
),
Currency::RUB =>
//format!("рубл{}", NOUN_1ST_GROUP_MASCULINE_SOFT_DECLENSIONS[number_idx][declination_idx]),
Copy link
Owner

Choose a reason for hiding this comment

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

there are still a lot of previously-used comments that are removed from usage, is this supposed to act like documentation?

Currency::RUB =>
//format!("рубл{}", NOUN_1ST_GROUP_MASCULINE_SOFT_DECLENSIONS[number_idx][declination_idx]),
{
String::from("руській воєнний корабль іді нахуй")
Copy link
Owner

Choose a reason for hiding this comment

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

or is this just a little troll with that haha :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just... won't fix. Maybe someday someone will be able to do it. But not me, not now.

Copy link
Owner

Choose a reason for hiding this comment

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

I'll keep it for now haha! I probably won't keep it forever though, as I want my lib to be usable in the most cases possible (even though in theory the license added a "no warranty" section). I'll keep it for a few releases and will fix that later.

Thanks though for putting the actual thing in comments!

Currency::ZAR => format!(
"ранд{}",
NOUN_2ST_GROUP_HARD_DECLENSIONS[number_idx][declination_idx]
),
//_ => currency.default_string(self.number == GrammaticalNumber::Plural),
Copy link
Owner

Choose a reason for hiding this comment

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

related with #21, this is supposed to be my way of doing, by putting a "default value" through a default_string function. using non_exhaustive is better that this, but my initial plan was to keep this uncommented in case someone in the future adds a currency.

I've also added a bunch of currencies in the past just to make sure adding new currencies isn't supposed to happen often

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think currencies are updating more quickly.
In Ukraine, we had 3 currencies over the past 35 years (Soviet ruble, Ukrainian karbovanets, Ukrainian hryvnia), and expect Euro to be here in 10 years. There are some 180 currencies in the world; even if the average time of life of the currency is 200 year (clearly an overestimation), it still means one currency is changed in a year and 40 days.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anyway, I think it's a good idea to leave it there - when the new currency will be added, this will at least help to fix the build for testing other languages.

Currency::RUB =>
//format!("копійк{}", NOUN_1ST_GROUP_FEMININE_HARD_DECLENSIONS[number_idx][declination_idx]),
{
String::from("руській воєнний корабль іді нахуй")
Copy link
Owner

Choose a reason for hiding this comment

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

I'm torn between keeping this or putting the original format! just to make sure the lib is usable haha

src/lang/uk.rs Show resolved Hide resolved
src/lang/uk.rs Show resolved Hide resolved
@Ballasi
Copy link
Owner

Ballasi commented Dec 12, 2023

Thank you for your hard work, it's very much appreciated!

I can be a little bit picky on my code review, it's just that I want it to be perfect, but your work is very well done, thank you again!

@Ballasi
Copy link
Owner

Ballasi commented Dec 14, 2023

Hey, one small thing: there also needs to be two lines added in README.md and src/lib.rs in the Supported languages section to add a note for Ukrainian!

@pavloslav
Copy link
Contributor Author

Added to Supported languages.
Also rebased on current master, for cleaner merge.

README.md Outdated
| Flag | Code | ISO 639-1 | Language | 42 |
| ---- | ----------------- | --------- | ---------- | --------- |
| 🇺🇸🇬🇧 | `Lang::English` | `en` | English | forty-two |
| 🇺🇦 | `Lang::Ukrainian` | `ua` | Ukrainian | сорок два |
Copy link
Owner

Choose a reason for hiding this comment

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

ISO 639-1 code of Ukrainian is uk, not ua :)

src/lib.rs Outdated
* | Flag | Code | ISO 639-1 | Language | 42 |
* | ---- | ----------------- | --------- | ---------- | --------- |
* | 🇺🇸🇬🇧 | `Lang::English` | `en` | English | forty-two |
* | 🇺🇦 | `Lang::Ukrainian` | `ua` | Ukrainian | сорок два |
Copy link
Owner

Choose a reason for hiding this comment

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

ditto

@pavloslav
Copy link
Contributor Author

Pavlo, you're working late once again...

@pavloslav
Copy link
Contributor Author

Done

@Ballasi Ballasi added the language addition Previously unsupported language that is set to be implemented label Dec 15, 2023
@Ballasi Ballasi merged commit 7c762ac into Ballasi:master Dec 15, 2023
@Ballasi
Copy link
Owner

Ballasi commented Dec 15, 2023

Thanks a lot Pavlo! that's very appreciated :)

@Ballasi Ballasi mentioned this pull request Mar 27, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language addition Previously unsupported language that is set to be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants