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

Missing Duration support #13

Open
niondir opened this issue Aug 21, 2017 · 6 comments
Open

Missing Duration support #13

niondir opened this issue Aug 21, 2017 · 6 comments
Assignees

Comments

@niondir
Copy link

niondir commented Aug 21, 2017

What abbout support for Durations?

I would need something like FmtDuration(d time.Duration) to get "20 days 10 hours 5 minutes 3 seconds"

@deankarn
Copy link
Contributor

Hey @niondir that is definitely something I would like to add in some time in the future :)

I definitely want to get the data being generated from the new JSON CLDR files rather than the old XML to make additions a little easier first though and am finding it very hard to find time to get to it though.

@deankarn deankarn self-assigned this Aug 21, 2017
@niondir
Copy link
Author

niondir commented Mar 22, 2018

Any news here?

I just spend some time looking into the CLDR files. What's wrong with the XML?

As of durations I found them in /common/main/*.xml <units> in three "length" types long, short and narrow. If we add the duration "units" we could even add all units in general.

Example from en.xml:

Long:
<unit type="duration-week">
	<displayName>weeks</displayName>
	<unitPattern count="one">{0} week</unitPattern>
	<unitPattern count="other">{0} weeks</unitPattern>
	<perUnitPattern>{0} per week</perUnitPattern>
</unit>

Short:
<unit type="duration-week">
	<displayName>weeks</displayName>
	<unitPattern count="one">{0} wk</unitPattern>
	<unitPattern count="other">{0} wks</unitPattern>
	<perUnitPattern>{0}/w</perUnitPattern>
</unit>

Narrow:
<unit type="duration-week">
	<displayName>wk</displayName>
	<unitPattern count="one">{0}w</unitPattern>
	<unitPattern count="other">{0}w</unitPattern>
</unit>

@deankarn
Copy link
Contributor

Hey @nikolay-turpitko nothing is wrong with the XML per se, I want to add this along with individual format methods for seconds, minutes, hours etc in case someone only wanted the total in say minutes only.

As I said, I just am having trouble finding time getting to it, PR's are welcome :)

@nikolay-turpitko
Copy link
Contributor

@joeybloggs @niondir
Guys, I'd like to help, but I have not so much free time as well.
Also, I'm not currently use this project, so not quite understand what kind of help do you need here.
If you want programming/testing/translation assistance, please be more specific and describe task in a plain English as concrete and detailed as you can. I can invest only so much of my free hours after my daily job, so it's difficult to me to investigate, digest, guess stuff and go into prolonged discussions. So, if you really need my help, please give me some context. What's going on here, what's the current state of affairs, what's need to be done, what do you think is appropriate to accomplish this task (your design view in plain English, preferably even step-by-step instruction), some test cases and references to required documentation, etc.

@deankarn
Copy link
Contributor

Thanks I will try to create a project plan in the coming weeks

@nikolay-turpitko
Copy link
Contributor

BTW, (not directly related to the topic of this issue) I've stumped on some interesting related projects. Probably you are aware of them, but just in case:
https://godoc.org/golang.org/x/text/message
https://godoc.org/golang.org/x/text/feature/plural

I haven't tried them myself, currently I do not involved into any multilingual projects. Take a look, may be there is something useful.

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

No branches or pull requests

3 participants