dromara / carbon

A simple, semantic and developer-friendly golang package for time
https://pkg.go.dev/github.com/golang-module/carbon/v2
MIT License
4.77k stars 238 forks source link

Farsi translation is wrong #247

Closed zumoshi closed 3 weeks ago

zumoshi commented 3 weeks ago

Hello,

I encountered an issue with the following code:

fmt.Println(carbon.CreateFromDateTime(2024, 9, 29, 14, 10, 43).SetLocale("fa").DiffForHumans(carbon.CreateFromDateTime(2024, 9, 29, 12, 10, 43)))

golang version: go1.23.1 linux/amd64

carbon version: v2.3.12

time zone: N/A

I expected to get:

2 ساعت بعد

But I actually get:

بعد ۱ ساعت 2

(there is an extra 1 in the output)

looking through lang/fa.json, while the words themselves are correct, it seems the difficulty of handling mixed direction text has led to | character being put in the wrong spot.

image

both 1 and %d are on the same side...

Thanks!