Skip to content

Commit 3367979

Browse files
committed
Add more filters to change requests
1 parent 0b9bb03 commit 3367979

File tree

3 files changed

+84
-16
lines changed

3 files changed

+84
-16
lines changed

projects/budgetkey/src/assets/themes/theme.budgetkey.he.json

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,17 @@
248248
"display": "בשנת התקציב",
249249
"id": "fiscal-year",
250250
"options": [
251-
{
252-
"display": "כל שנות התקציב",
253-
"id": "all"
254-
},
255251
{
256252
"display": "2025",
257253
"filters": {
258254
"year": 2025
259255
},
260256
"id": "2025"
261257
},
258+
{
259+
"display": "כל שנות התקציב",
260+
"id": "all"
261+
},
262262
{
263263
"display": "2024",
264264
"filters": {
@@ -382,10 +382,42 @@
382382
"id": "pending"
383383
}
384384
]
385+
},
386+
{
387+
"display": "סוג",
388+
"id": "kind",
389+
"options": [
390+
{
391+
"display": "כל הסוגים",
392+
"id": "all"
393+
},
394+
{
395+
"display": "לאישור וועדת הכספים",
396+
"filters": {
397+
"change_type_name": "אישור ועדה"
398+
},
399+
"id": "approve"
400+
},
401+
{
402+
"display": "הודעה לוועדת הכספים",
403+
"filters": {
404+
"change_type_name": "הודעה לועדה"
405+
},
406+
"id": "notify"
407+
},
408+
{
409+
"display": "באישור שר האוצר",
410+
"filters": {
411+
"change_type_name": "אישור אגף"
412+
},
413+
"id": "minister"
414+
}
415+
]
385416
}
386417
],
387418
"id": "national-budget-changes",
388419
"name": "שינויים תקציביים",
420+
"ordering": "-date",
389421
"placeholder": "חפשו פרטים על שינויים תקציביים...",
390422
"types": [
391423
"national-budget-changes"

themes/extract_translations.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
API = os.environ['TX_TOKEN']
1313
HEB=re.compile('[א-ת]')
14-
OUTBASE='../projects/budgetkey/src/assets/themes/'
14+
THEMES = Path(__file__).parent
15+
ROOT = THEMES.parent
16+
OUTBASE = ROOT / 'projects/budgetkey/src/assets/themes/'
1517

1618
transifex_api.setup(auth=API)
1719

@@ -22,9 +24,10 @@
2224
]
2325

2426
def sources(kind):
25-
for fn in Path('.').glob('{}*.he.json'.format(kind[0])):
27+
for fn in THEMES.glob('{}*.he.json'.format(kind[0])):
2628
project = str(fn).split('.')[1]
27-
yield fn, project, json.load(open(fn))
29+
print('Found', fn, project)
30+
yield fn, fn.name, project, json.load(open(fn))
2831

2932
def keys(v, root=''):
3033
if isinstance(v, list):
@@ -44,7 +47,7 @@ def replace_with(v, replacements, project):
4447
yield k, replacements[k]
4548

4649
def allkeys(kind):
47-
for _, project, theme in sources(kind):
50+
for _, _, project, theme in sources(kind):
4851
yield from keys(theme, project + '___')
4952

5053
def hebrew(x):
@@ -89,9 +92,9 @@ def handle_kind(kind):
8992
translations = requests.get(url).text
9093
translations = yaml.load(translations, Loader=SafeLoader)['he']
9194

92-
for srcfn, project, theme in sources(kind):
93-
fn = str(srcfn).replace('.he.', f'.{lang}.')
94-
fn = OUTBASE + fn
95+
for srcfn, filename, project, theme in sources(kind):
96+
fn = str(filename).replace('.he.', f'.{lang}.')
97+
fn = OUTBASE / fn
9598
for k, v in list(replace_with(theme, translations, project)):
9699
parts = k.split('___')[1:]
97100
ptr = theme
@@ -105,10 +108,11 @@ def handle_kind(kind):
105108
ptr[parts[0]] = v
106109
json.dump(theme, open(fn, 'w'), indent=2, sort_keys=True, ensure_ascii=False)
107110
with srcfn.open('r') as f:
108-
outsrcfn = str(OUTBASE / srcfn)
111+
outsrcfn = str(OUTBASE / filename)
109112
if '.he.' not in outsrcfn:
110113
outsrcfn = outsrcfn.replace('.json', '.he.json')
111114
with open(outsrcfn, 'w') as f2:
115+
print('Copying', srcfn, 'to', outsrcfn)
112116
json.dump(json.load(f), f2, indent=2, sort_keys=True, ensure_ascii=False)
113117

114118

themes/theme.budgetkey.he.json

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,22 +186,23 @@
186186
"description": "שינויים בתקציב המדינה המתרחשים במהלך השנה.",
187187
"types": ["national-budget-changes"],
188188
"placeholder": "חפשו פרטים על שינויים תקציביים...",
189+
"ordering": "-date",
189190
"filterMenu": [
190191
{
191192
"id": "fiscal-year",
192193
"display": "בשנת התקציב",
193194
"options":[
194-
{
195-
"id": "all",
196-
"display": "כל שנות התקציב"
197-
},
198195
{
199196
"id": "2025",
200197
"display": "2025",
201198
"filters": {
202199
"year": 2025
203200
}
204201
},
202+
{
203+
"id": "all",
204+
"display": "כל שנות התקציב"
205+
},
205206
{
206207
"id": "2024",
207208
"display": "2024",
@@ -325,6 +326,37 @@
325326
}
326327
}
327328
]
329+
},
330+
{
331+
"id": "kind",
332+
"display": "סוג",
333+
"options": [
334+
{
335+
"id": "all",
336+
"display": "כל הסוגים"
337+
},
338+
{
339+
"id": "approve",
340+
"display": "לאישור וועדת הכספים",
341+
"filters": {
342+
"change_type_name": "אישור ועדה"
343+
}
344+
},
345+
{
346+
"id": "notify",
347+
"display": "הודעה לוועדת הכספים",
348+
"filters": {
349+
"change_type_name": "הודעה לועדה"
350+
}
351+
},
352+
{
353+
"id": "minister",
354+
"display": "באישור שר האוצר",
355+
"filters": {
356+
"change_type_name": "אישור אגף"
357+
}
358+
}
359+
]
328360
}
329361
]
330362
},

0 commit comments

Comments
 (0)