-
Notifications
You must be signed in to change notification settings - Fork 965
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 TimeSpan.ToAge() extension method #1068
Conversation
I think it would be better if the addition of
|
Ok, I've read some info about the hyphenated age. So, hyphenated age is an age adjective. These do exist in languages other than English, in my native Russian for example:
"летний" here means "years-old" and "пятидесяти" - is an age component. Similar for German: "fünfzigjähriger" So I think: we could accept the The points to consider:
|
Why do we need both a new |
I must admit I wasn't too sure about that myself... But if I modify the PR according to what I proposed here, then this question will become irrelevant, right? 😄 |
6682f2b
to
9ae7082
Compare
Hey @clairernovotny & @hazzik I finally decided to drop the implementation of the so-called hyphenated (aka noun or pre-noun modifier) age expression, as it was too controversial. Can we now agree on this simpler PR? If not, please advise so I may make the necessary changes to have this PR accepted and merged. |
@SimonCropp, do you think I should resurrect this PR, at least in its simplified form (refer to this comment)? |
@louis-z yeah i think a simpler implementation with a subset would be easier to get in should we close this one for now? |
@louis-z could you please resolve conflicts |
- Add tests for both English and 1 non-English (i.e. French) cultures
I rebased my branch, as per @hazzik's request. @SimonCropp, what do you think? |
@louis-z can you add an explanation of the feature to the readme |
Done |
"TimeSpanHumanize_Age"
resource, which indicates how to format a humanized TimeSpan as an age expression, when the two differ.Resources.TryGetResource()
method, which tries to retrieve a resource for a given culture but without falling back on the default culture. This will allow us to define the"TimeSpanHumanize_Age"
resource foren-US
(aka the default culture), but not have other cultures fall back on that culture's resource.DefaultFormatter.TimeSpanHumanize_Age()
, which resorts toResources.TryGetResource()
to determine how to express a TimeSpan as age. If no resource is found for the given culture, it will simply output the standard humanized TimeSpan as is. (For other cultures where standard TimeSpan and age expression differ, such as many germanic languages,"TimeSpanHumanize_Age"
will eventually need to be defined. However, this is outside the scope of this PR.)Fixes #968
Here is a checklist you should tick through before submitting a pull request:
dev
branch (more info below)fixes #<the issue number>
build.cmd
orbuild.ps1
and ensure there are no test failures