Debian Codegraph @

src/timeago/locales/pl.py

raw symbols SCIP
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 '''
4 Created on 2018-11-11
5
6 @author: marcel-odya
7 '''
8
9 base = [
10 ["właśnie teraz", "za chwilę"],
11 ["%s sekund temu", "za %s sekund", "%s sekundy temu", "za %s sekundy"],
12 ["minutę temu", "za minutę"],
13 ["%s minut temu", "za %s minut", "%s minuty temu", "za %s minuty"],
14 ["godzinę temu", "za godzinę"],
15 ["%s godzin temu", "za %s godzin", "%s godziny temu", "za %s godziny"],
16 ["1 dzień temu", "za 1 dzień"],
17 ["%s dni temu", "za %s dni", "%s dni temu", "za %s dni"],
18 ["tydzień temu", "za tydzień"],
19 ["%s tygodni temu", "za %s tygodni", "%s tygodnie temu", "za %s tygodnie"],
20 ["miesiąc temu", "za miesiąc"],
21 ["%s miesięcy temu", "za %s miesięcy", "%s miesiące temu", "za %s miesiące"],
22 ["rok temu", "za rok"],
23 ["%s lat temu", "za %s lat", "%s lata temu", "za %s lata"]
24 ]
25
26
27 def generate(row, y):
28 def formatting(time):
29 '''
30 Uses the 3rd and 4th field of the list in every 2 entries -
31 the ones containing %s, if the diff ends with 2, 3 or 4 but
32 not with 12, 13 or 14.
33 '''
34 if row % 2 == 0:
35 return base[row][y]
36 last_number = time % 10
37 last_two_numbers = time % 100
38 if last_number in range(2, 5) and last_two_numbers not in range(12, 15):
39 return base[row][y + 2]
40 return base[row][y]
41
42 return formatting
43
44
45 LOCALE = generate