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

add russian translation for ToWords #147

Closed
wants to merge 13 commits into from
Closed

Conversation

mexx
Copy link
Collaborator

@mexx mexx commented Apr 9, 2014

No description provided.

@hazzik
Copy link
Member

hazzik commented Apr 9, 2014

Related to #74, #149

@hazzik hazzik mentioned this pull request Apr 9, 2014
@hazzik
Copy link
Member

hazzik commented Apr 9, 2014

ToOrdinalWords would be tricky:)

{
public NumberToWordsTests() : base("ru-RU") { }

[InlineData(0, "ноль")]
Copy link
Member

Choose a reason for hiding this comment

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

Holy crap!! ;)

@MehdiK
Copy link
Member

MehdiK commented Apr 10, 2014

This is awesome.

Thanks a lot for it @mexx. Do you think you can fix #74 first, so we can merge that in, and then base this work (and RussianFormatter) on that? That would be much more awesomerer :)

@mexx
Copy link
Collaborator Author

mexx commented Apr 10, 2014

I think we even tackle #149 down first, so the formatting is done in one place.
Afterwards we can approach #74 and ToWords related translation PRs.

@MehdiK
Copy link
Member

MehdiK commented Apr 10, 2014

#149 is merged now :)

@mexx
Copy link
Collaborator Author

mexx commented Apr 11, 2014

ToWords is completed now.

{
if (number == 0)
return "cero";

if (number < 0)
return string.Format("menos {0}", Convert(Math.Abs(number)));
return string.Format("menos {0}", Convert(Math.Abs(number), gender));
Copy link
Member

Choose a reason for hiding this comment

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

I think this changes to a white-space need to be reverted.

@hazzik
Copy link
Member

hazzik commented Apr 11, 2014

I think commits related to #74 shall go to a separate pull request. Everything else looks good.

/// <summary>
/// Options for specifying the desired grammatical case for the output words
/// </summary>
public enum GrammaticalCase
Copy link
Member

Choose a reason for hiding this comment

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

Cool. Thanks for promoting this.

@mexx
Copy link
Collaborator Author

mexx commented Apr 12, 2014

Currently I found a better way to add GrammaticalGender to INumberToWordsConverter, so only translations that need it needs to be changed.
I'll provide an update shortly.


return resourceKey;
var grammaticalNumber = RussianGrammaticalNumberDetector.Detect(number);
var suffix = _map[(int) grammaticalNumber];
Copy link
Member

Choose a reason for hiding this comment

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

I don't like to depend on implicit order of enum members. I will change this to two if conditions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I'll address this.

Copy link
Member

Choose a reason for hiding this comment

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

Cool. Can you pop on Skype for a sec please? I'm www.mehdi-khalili.com

@mexx
Copy link
Collaborator Author

mexx commented Apr 12, 2014

@MehdiK here we go

@@ -410,6 +410,15 @@ Humanizer can change numbers to words using the `ToWords` extension:
3501.ToWords() => "three thousand five hundred and one"
```

You can also pass a second argument, `GrammaticalGender`, to `ToWords` to specify which gender the number should be outputted in. The possible values are `GrammaticalGender.Masculine`, `GrammaticalGender.Feminine` and `GrammaticalGender.Neuter`.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this :)

@MehdiK
Copy link
Member

MehdiK commented Apr 12, 2014

Nice work @mexx. This is going to make things very simple for others. Thanks a lot. Merged now.

@MehdiK MehdiK closed this Apr 12, 2014
@mexx
Copy link
Collaborator Author

mexx commented Apr 12, 2014

I will have to go further with ToWords as it also affected by the grammatical case, currently we have GrammaticalCase.Nominative implemented.

@MehdiK MehdiK mentioned this pull request Apr 12, 2014
@MehdiK
Copy link
Member

MehdiK commented Apr 12, 2014

This is now published to NuGet as v1.21.1. Thanks.

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

Successfully merging this pull request may close these issues.

3 participants