Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
21 changes: 21 additions & 0 deletions src/pendulum/locales/gu/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
gu custom locale file.
"""

translations = {
"units": {"few_second": "અમુક સેકંડ"},
# Relative time
"ago": "{} પહેલાં",
"from_now": "{} માં",
"after": "{0} પછી",
"before": "{0} પહેલાં",
# Date formats
"date_formats": {
"LTS": "h:mm:ss A",
"LT": "h:mm A",
"L": "DD/MM/YYYY",
"LL": "D MMMM YYYY",
"LLL": "D MMMM YYYY, h:mm A",
"LLLL": "dddd, D MMMM YYYY, h:mm A",
},
}
221 changes: 221 additions & 0 deletions src/pendulum/locales/gu/locale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
from pendulum.locales.gu.custom import translations as custom_translations


"""
gu locale file.

It has been generated automatically and must not be modified directly.
"""


locale = {
'plural': lambda n: 'one' if ((n == n and ((n == 0))) or (n == n and ((n == 1)))) else 'other',
'ordinal': lambda n: 'one',
'translations': {
'days': {
'abbreviated': {
0: 'સોમ',
1: 'મંગળ',
2: 'બુધ',
3: 'ગુરુ',
4: 'શુક્ર',
5: 'શનિ',
6: 'રવિ',
},
'narrow': {
0: 'સો',
1: 'મં',
2: 'બુ',
3: 'ગુ',
4: 'શુ',
5: 'શ',
6: 'ર',
},
'short': {
0: 'સો',
1: 'મં',
2: 'બુ',
3: 'ગુ',
4: 'શુ',
5: 'શ',
6: 'ર',
},
'wide': {
0: 'સોમવાર',
1: 'મંગળવાર',
2: 'બુધવાર',
3: 'ગુરુવાર',
4: 'શુક્રવાર',
5: 'શનિવાર',
6: 'રવિવાર',
},
},
'months': {
'abbreviated': {
1: 'જાન્યુ',
2: 'ફેબ્રુ',
3: 'માર્ચ',
4: 'એપ્રિલ',
5: 'મે',
6: 'જૂન',
7: 'જુલાઈ',
8: 'ઑગસ્ટ',
9: 'સપ્ટે',
10: 'ઑક્ટો',
11: 'નવે',
12: 'ડિસે',
},
'narrow': {
1: 'જા',
2: 'ફે',
3: 'મા',
4: 'એ',
5: 'મે',
6: 'જૂ',
7: 'જુ',
8: 'ઑ',
9: 'સ',
10: 'ઑ',
11: 'ન',
12: 'ડિ',
},
'wide': {
1: 'જાન્યુઆરી',
2: 'ફેબ્રુઆરી',
3: 'માર્ચ',
4: 'એપ્રિલ',
5: 'મે',
6: 'જૂન',
7: 'જુલાઈ',
8: 'ઑગસ્ટ',
9: 'સપ્ટેમ્બર',
10: 'ઑક્ટોબર',
11: 'નવેમ્બર',
12: 'ડિસેમ્બર',
},
},
'units': {
'year': {
'one': '{0} વર્ષ',
'other': '{0} વર્ષ',
},
'month': {
'one': '{0} મહિનો',
'other': '{0} મહિના',
},
'week': {
'one': '{0} અઠવાડિયું',
'other': '{0} અઠવાડિયા',
},
'day': {
'one': '{0} દિવસ',
'other': '{0} દિવસ',
},
'hour': {
'one': '{0} કલાક',
'other': '{0} કલાક',
},
'minute': {
'one': '{0} મિનિટ',
'other': '{0} મિનિટ',
},
'second': {
'one': '{0} સેકંડ',
'other': '{0} સેકંડ',
},
'microsecond': {
'one': '{0} માઇક્રોસેકંડ',
'other': '{0} માઇક્રોસેકંડ',
},
},
'relative': {
'year': {
'future': {
'other': '{0} વર્ષમાં',
'one': '{0} વર્ષમાં',
},
'past': {
'other': '{0} વર્ષ પહેલાં',
'one': '{0} વર્ષ પહેલાં',
},
},
'month': {
'future': {
'other': '{0} મહિનામાં',
'one': '{0} મહિનામાં',
},
'past': {
'other': '{0} મહિના પહેલાં',
'one': '{0} મહિના પહેલાં',
},
},
'week': {
'future': {
'other': '{0} અઠવાડિયામાં',
'one': '{0} અઠવાડિયામાં',
},
'past': {
'other': '{0} અઠવાડિયા પહેલાં',
'one': '{0} અઠવાડિયા પહેલાં',
},
},
'day': {
'future': {
'other': '{0} દિવસમાં',
'one': '{0} દિવસમાં',
},
'past': {
'other': '{0} દિવસ પહેલાં',
'one': '{0} દિવસ પહેલાં',
},
},
'hour': {
'future': {
'other': '{0} કલાકમાં',
'one': '{0} કલાકમાં',
},
'past': {
'other': '{0} કલાક પહેલાં',
'one': '{0} કલાક પહેલાં',
},
},
'minute': {
'future': {
'other': '{0} મિનિટમાં',
'one': '{0} મિનિટમાં',
},
'past': {
'other': '{0} મિનિટ પહેલાં',
'one': '{0} મિનિટ પહેલાં',
},
},
'second': {
'future': {
'other': '{0} સેકંડમાં',
'one': '{0} સેકંડમાં',
},
'past': {
'other': '{0} સેકંડ પહેલાં',
'one': '{0} સેકંડ પહેલાં',
},
},
},
'day_periods': {
"midnight": "મધ્યરાત્રિ",
"am": "AM",
"noon": "બપોર",
"pm": "PM",
"morning1": "સવારે",
"afternoon1": "બપોરે",
"evening1": "સાંજે",
"night1": "રાત્રે",
},
'week_data': {
'min_days': 1,
'first_day': 0,
'weekend_start': 5,
'weekend_end': 6,
},
},
'custom': custom_translations
}
76 changes: 76 additions & 0 deletions tests/localization/test_gu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from __future__ import annotations

import pendulum


locale = "gu"


def test_diff_for_humans():
with pendulum.travel_to(pendulum.datetime(2025, 6, 4), freeze=True):
diff_for_humans()


def diff_for_humans():
d = pendulum.now().subtract(seconds=1)
assert d.diff_for_humans(locale=locale) == "અમુક સેકંડ પહેલાં"

d = pendulum.now().subtract(seconds=2)
assert d.diff_for_humans(locale=locale) == "અમુક સેકંડ પહેલાં"

d = pendulum.now().subtract(seconds=21)
assert d.diff_for_humans(locale=locale) == "21 સેકંડ પહેલાં"

d = pendulum.now().subtract(minutes=1)
assert d.diff_for_humans(locale=locale) == "1 મિનિટ પહેલાં"

d = pendulum.now().subtract(minutes=2)
assert d.diff_for_humans(locale=locale) == "2 મિનિટ પહેલાં"

d = pendulum.now().subtract(hours=1)
assert d.diff_for_humans(locale=locale) == "1 કલાક પહેલાં"

d = pendulum.now().subtract(hours=2)
assert d.diff_for_humans(locale=locale) == "2 કલાક પહેલાં"

d = pendulum.now().subtract(days=1)
assert d.diff_for_humans(locale=locale) == "1 દિવસ પહેલાં"

d = pendulum.now().subtract(days=2)
assert d.diff_for_humans(locale=locale) == "2 દિવસ પહેલાં"

d = pendulum.now().subtract(weeks=1)
assert d.diff_for_humans(locale=locale) == "1 અઠવાડિયા પહેલાં"

d = pendulum.now().subtract(weeks=2)
assert d.diff_for_humans(locale=locale) == "2 અઠવાડિયા પહેલાં"

d = pendulum.now().subtract(months=1)
assert d.diff_for_humans(locale=locale) == "1 મહિના પહેલાં"

d = pendulum.now().subtract(months=2)
assert d.diff_for_humans(locale=locale) == "2 મહિના પહેલાં"

d = pendulum.now().subtract(years=1)
assert d.diff_for_humans(locale=locale) == "1 વર્ષ પહેલાં"

d = pendulum.now().subtract(years=2)
assert d.diff_for_humans(locale=locale) == "2 વર્ષ પહેલાં"

d = pendulum.now().add(seconds=1)
assert d.diff_for_humans(locale=locale) == "અમુક સેકંડ માં"

d = pendulum.now().add(seconds=1)
d2 = pendulum.now()
assert d.diff_for_humans(d2, locale=locale) == "અમુક સેકંડ પછી"
assert d2.diff_for_humans(d, locale=locale) == "અમુક સેકંડ પહેલાં"

assert d.diff_for_humans(d2, True, locale=locale) == "અમુક સેકંડ"
assert d2.diff_for_humans(d.add(seconds=1), True, locale=locale) == "અમુક સેકંડ"


def test_format():
d = pendulum.datetime(2016, 8, 29, 7, 3, 6, 123456)
assert d.format("dddd", locale=locale) == "સોમવાર"
assert d.format("ddd", locale=locale) == "સોમ"
assert d.format("dd", locale=locale) == "સો"