golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.08k stars 17.55k forks source link

x/text: localization support #12750

Open mpvl opened 9 years ago

mpvl commented 9 years ago

This issue is intended as an umbrella tracking issue for localization support.

Localization support includes:

Details to be covered in design docs.

Junaid-Sakib commented 3 years ago

Do we have the localisation support for date now? Or if anyone can suggest an alternate to have localisation support for dates.

robfig commented 2 years ago

It would be nice to have date localization in x/text. In the meantime, between x/text and github.com/klauspost/lctime everything might be covered. I'm not sure why lctime is archived though.. perhaps that means it won't receive updates to the language rules. cc @klauspost

klauspost commented 2 years ago

@robfig It is a fork from a now deleted package by @variadico

I mainly added a non-stateful interface so it could be used without affecting global package state.

Since I don't really have intentions of maintaining/bugfixing this and there was a low user count, I thought it would be most fair to archive it. If someone wants to maintain a fork I'd be happy to link to it.

wolfgangmeyers commented 2 years ago

golang.org/x/text/number offers a way to localize decimal values, but it seems that I can only initialize the Formatter using a float. I have a need to preserve the precision present in a decimal value that is represented as a string, but when converting to float we are getting rounding errors. It is important to prevent the rounding errors, because we're trying to represent the exact values in financial transactions in different locales. Would it be possible to add support to initialize number.Decimal using a string instead of a float?

bojanz commented 2 years ago

@wolfgangmeyers You might find my package useful: https://github.com/bojanz/currency

It solves the problem of representing and formatting currency amounts for the time being. I'd love to see x/text maintained again though.