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

dutch localization #336

Closed
Yustie opened this issue Sep 14, 2014 · 16 comments
Closed

dutch localization #336

Yustie opened this issue Sep 14, 2014 · 16 comments

Comments

@Yustie
Copy link
Contributor

Yustie commented Sep 14, 2014

Hi,

Is there a way to have this library display numbers only instead of a combination of words and numbers?
Let me elaborate, in dutch it's displaying the duration like this:
één week, 2 dagen, 15 minuten
for a certain amount of milliseconds.

What I would like to have is:
1 week, 2 dagen, 15 minuten.

Is this possible?

Also, it shouldn't display the last comma, instead, it should say 'and'.

1 week, 2 days and 15 minutes
instead of:
1 week, 2 days, 15 minutes

@Yustie
Copy link
Contributor Author

Yustie commented Sep 17, 2014

Anyone?

@MehdiK
Copy link
Member

MehdiK commented Sep 17, 2014

Hi @Yustie

That is how it's supposed to work. I'm not sure why you're seeing a different behaviour. This should be a problem with Dutch formatter. I will check it out later.

WRT a different output format, that part is hardcoded in the implementation of TimeSpan.Humanize.

@Yustie
Copy link
Contributor Author

Yustie commented Sep 18, 2014

Hi,

Ok.

About your WRT, how about:
if (precision > 1) // means we have more than 1 time unit. { int index = result.ToString().LastIndexOf(','); // this will get the last comma between 2 time units. result= result.Replace(",", "and", index, 1); // replace it with the word 'and' (of course depending on the users language).
}

@Yustie
Copy link
Contributor Author

Yustie commented Sep 26, 2014

Hi,

Whats the status?

@MehdiK
Copy link
Member

MehdiK commented Oct 4, 2014

@Yustie

You see that behavior due to the way Dutch localisation has been coded. As you can see for 1 week we're returning één week. This is not standard across all resources though. For example the English resource returns 1 week.

if (precision > 1) // means we have more than 1 time unit. { int index = result.ToString().LastIndexOf(','); // this will get the last comma between 2 time units. result= result.Replace(",", "and", index, 1); // replace it with the word 'and' (of course depending on the users language).
}

This is certainly possible. If you like this behaviour please send a Pull Request and we will discuss it. The pull request should allow proper localisation of and.

@Yustie
Copy link
Contributor Author

Yustie commented Oct 4, 2014

I see.. So can we just replace the één with 1?
I'm actually a noob when it comes to forks and pull requests here on github.

@MehdiK
Copy link
Member

MehdiK commented Oct 4, 2014

Thinking about it now, I think we do need that consistency. So, yes please.

You might follow the contribution guide to get started. Please tackle the resources on a separate PR. Let me know if you have any questions. I will try to be more responsive :)

@Yustie
Copy link
Contributor Author

Yustie commented Oct 7, 2014

I have no idea how github works. I won't be able to contribute to any project hosted here any time soon.

@MehdiK
Copy link
Member

MehdiK commented Oct 7, 2014

You should use GitHub For Windows. It makes git and GitHub very easy to work with.

Nice try but I still expect a PR ;)

@hazzik
Copy link
Member

hazzik commented Oct 7, 2014

It makes git and GitHub very easy to work with.

As well as very easy to fail.

@MehdiK
Copy link
Member

MehdiK commented Oct 7, 2014

I don't use any UI on top of git. I only use git commands; but GH4W lowers the scary git barrier and makes for a good starting point for new comers.

@Yustie
Copy link
Contributor Author

Yustie commented Oct 18, 2014

Hi,

I'm up and running. Just changed the 'één' to 1 in dutch. Now I'm adding the "and" if there are multiple 'precisions'. Makes the last comma get replaced by the word 'and'. This is language dependent. What are your ideas on how to do this? If it were up to me, I'd just add a new resource in the existing ones instead of a new resource file. Something like 'Humanizer_And', you like?

@MehdiK
Copy link
Member

MehdiK commented Oct 24, 2014

@Yustie

Please submit the localisation change as a separate PR. That's safe to go in.

I am a bit unsure about changing the last comma to 'and'. Humanizer (or any other project) can't be configured and tweaked to behave properly for everyone regardless of the context. That ultimate flexibility will cripple the solution. So I'd recommend creating your own wrapper around the API that replaces the last comma with 'and' in Dutch. That way the existing behaviour is not touched.

@Yustie
Copy link
Contributor Author

Yustie commented Oct 26, 2014

About your last paragraph, I don't need it just for the Dutch language, but all languages, as I have a localized application.

Sending in PR now without the 'and'.

@Yustie
Copy link
Contributor Author

Yustie commented Oct 29, 2014

Hi,

Can you check if the new PR has worked?

@MehdiK
Copy link
Member

MehdiK commented Nov 7, 2014

Fixed in #347

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

No branches or pull requests

3 participants