Skip to content

Commit

Permalink
Merge pull request #7 from imbue11235/fix/arabic-feature
Browse files Browse the repository at this point in the history
[Feature] Arabic
  • Loading branch information
imbue11235 authored Dec 19, 2021
2 parents 358d69f + 005c367 commit 7703854
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ humanize.SetFallbackLocale("my-fallback-locale")

Currently, the following locales are included in the `humanize` package:

- [Arabic](locale/ar/locale.go) - Thanks [@MohammadSaad1](https://github.com/MohammadSaad1)
- [Danish](locale/da/locale.go)
- [English](locale/en/locale.go)
- [German](locale/de/locale.go)
Expand All @@ -412,7 +413,6 @@ It would be greatly appreciated and help the package become even more usable acr

List of wanted locales:

- [ ] Arabic
- [ ] Dutch
- [ ] Finnish
- [ ] French
Expand Down
48 changes: 48 additions & 0 deletions locale/ar/locale.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ar

import "github.com/imbue11235/humanize/locale"

// Code contains the locale code for arabic locale
var Code = "ar"

// Locale contains the arabic locale data
var Locale = locale.Map{
"slice": locale.Map{
"connector": "و",
"rest": "[1] واحد آخر‎ | [2-*] آخرين‎ %d ",
},
"time": locale.Map{
"now": "الآن",
"future": "%s بعد",
"past": "%s قبل",
"estimation": locale.Map{
"s": "‎[1] ثانية‎ | [2] ثانيتين‎ | [3-10] ثوانٍ %d | [11-*] ثانية %d",
"m": "‎[1]‎ دقيقة‎‎ | [2] دقيقتين‎ | [3-10] دقائق‎‎ %d | [11-*]‎ دقيقة‎ %d",
"h": "[1] ساعة‎ | [2] سعتين‎ | [3-10] ساعات‎ %d | [11-*] ساعة‎ %d",
"d": "[1] يوم‎ | [2] يومين‎ | [3-10] أيام‎ %d | [11-99] يوما‎ %d | [100-*] يوم ",
"w": "[1] أسبوع‎ | [2] أسبوعين‎ | [3-10] أسابيع‎ %d | [11-99] أسبوعا ‎%d | [100-*] اسبوع",
"M": "[1] شهر‎ | [2] ‎شهرين‎ | [3-10] أشهر‎ %d | [11-99] شهرا %d | [100-*] شهر",
"y": "[1] سنة‎ | [2] سنتين‎ | [3-10] سنين‎ %d‎‎ | [11-*] سنة‎ %d",
"D": "[1] عقد‎ | [2] ‎عقدين‎ | [3-10] عقود‎ %d | [11-99] عقدا %d | [100-*] عقد",
"l": "وقت طويل",
},
"precision": locale.Map{
"s": "‎[1] %d ثانية‎ | [2] %d ثانيتين‎ | [3-10] ثوانٍ %d | [11-*] ثانية %d",
"m": "‎[1]‎ %d دقيقة‎‎ | [2] %d دقيقتين‎ | [3-10] دقائق‎‎ %d | [11-*]‎ دقيقة‎ %d",
"h": "[1] %d ساعة‎ | [2] %d سعتين‎ | [3-10] ساعات‎ %d | [11-*] ساعة‎ %d",
"d": "[1] %d يوم‎ | [2] %d يومين‎ | [3-10] أيام‎ %d | [11-99] يوما‎ %d | [100-*] يوم ",
"M": "[1] %d شهر‎ | [2] %d ‎شهرين‎ | [3-10] أشهر‎ %d | [11-99] شهرا %d | [100-*] شهر",
"y": "[1] %d سنة‎ | [2] %d سنتين‎ | [3-10] سنين‎ %d‎‎ | [11-*] سنة‎ %d",
},
},
"int": locale.Map{
"K": "[1] ألف‎ | [2] ألفين‎ | [3-*] ألوف",
"M": "[1] مليون‎ | [2] مليونين‎‎ | [3-*] ملايين",
"B": "[1] مليار‎ | [2] مليارين‎ | [3-*] المليارات ",
"T": "[1] تريليون‎ | [2] تريليونين‎ | [3-*] تريليونات",
"Q": "[1] كوادريليون‎ | [2] كوادرليونين‎ | [3-*] كوادرليونات‎",
"Qi": "[1] ‎‎كوينتيليون‎ | [2] ‎‎كوينتيليونين‎ | [3-*] ‎‎كوينتيليونات‎‎ ",
"Sx": "[1] سكستليون‎ | [2] ‎سكستليونين‎ | [3-*] سكستليونات",
"Sp": "[1] سبتليون‎ | [2] سبتليونين‎ | [3-*] سبتليونات‎‎",
},
}
2 changes: 2 additions & 0 deletions locale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/imbue11235/humanize/locale/da"
"github.com/imbue11235/humanize/locale/de"
"github.com/imbue11235/humanize/locale/en"
"github.com/imbue11235/humanize/locale/ar"
)

func TestLocaleManager(t *testing.T) {
Expand Down Expand Up @@ -47,6 +48,7 @@ func TestLocales(t *testing.T) {
{"en", en.Locale},
{"da", da.Locale},
{"de", de.Locale},
{"ar", ar.Locale},
}

requiredPaths := []string{
Expand Down

0 comments on commit 7703854

Please sign in to comment.