Skip to content

Commit

Permalink
chore: Merge remote-tracking branch 'origin/main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
callmemagnus committed Jan 7, 2024
2 parents 557f565 + 46f939f commit 9b43a17
Show file tree
Hide file tree
Showing 17 changed files with 16,265 additions and 14,999 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@
## v1.3.0-pre

- New admin screen in (additional settings) to configure (mostly hide) providers globally or per user group
- Integrated application with Nextcloud's Transifex

## [v1.2.4](https://github.com/callmemagnus/nextcloud-searchpage/compare/v1.2.3...v1.2.4)

- Fix the result presentation in dark-mode
- Updated dependencies

From 1.2.3 because version number was not incremented in info.xml

- Manually added some languages (uk, fr, tr, zh_HK)
- Manually updated de_DE

## [v1.2.3](https://github.com/callmemagnus/nextcloud-searchpage/compare/v1.2.2...v1.2.3)

- Manually added some languages (uk, fr, tr, zh_HK)
- Manually updated de_DE

## [v1.2.2](https://github.com/callmemagnus/nextcloud-searchpage/compare/v1.2.1...v1.2.2)

Expand Down
107 changes: 107 additions & 0 deletions bin/po_to_js_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/env python
import os
import sys
from pathlib import Path
import re

"""
GOAL take downloaded translation .po from transifex
and create the js and JSON files.
This should only be temporary as long as the sync does not work.
"""

cwd = os.getcwd()
target_dir = 'l10n'

print('Working in', cwd)

if not os.path.isdir(os.path.join(cwd, target_dir)):
print('{} does not exist, run this script from the root of your project'.format(target_dir))

def this_script_name():
return Path(sys.argv[0]).parts[-1]

def usage():
print('{} <lang_code> </path/to/file.po>'.format(this_script_name()))
sys.exit()

if not len(sys.argv) == 3:
usage()

lang_code = sys.argv[1]
po_file = sys.argv[2]

if not Path(po_file).is_file():
print('{} does not exist'.format(po_file))

target_files = {}
target_files['js'] = Path(os.path.join(cwd, target_dir, '{}.js'.format(lang_code)))
target_files['json'] = Path(os.path.join(cwd, target_dir, '{}.json'.format(lang_code)))

if target_files['js'].exists() or target_files['json'].exists():
print('{} related files exits'.format(lang_code))
sys.exit(1)

f = open(po_file, 'r')

lines = f.readlines()

readnext = False
lastid = None
all_labels = {}

for l in lines:
line = l.strip().replace('\n', '')
if line == '':
continue

if readnext or lastid:
if line == 'msgid ""':
# multiline msgid, not handled by this script
readnext = False
continue

key, text = line.split(' "')

if key == 'msgid':
lastid = '"{}'.format(text)
readnext = False
if key == 'msgstr':
all_labels[lastid] = '"{}'.format(text)
lastid = None

if re.fullmatch('#: /app/specialAppInfoFakeDummyForL10nScript.php:\d+', line):
readnext = True
continue

if re.fullmatch('#: /app/src/fakeLabels.ts:\d+', line):
readnext = True
continue

template = {}
template['js'] = """
OC.L10N.register(
"thesearchpage",
{
%%translations%%
},
"nplurals=2; plural=(n != 1);");
"""

template['json'] = """
{ "translations": {
%%translations%%
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
"""

translations = []

for k in all_labels:
translations.append('{}: {}'.format(k, all_labels[k]))


for ext in template:
f = open(target_files[ext].as_posix(), mode='w')
f.write(template[ext].replace('%%translations%%', ",\n ".join(translations)))
18 changes: 17 additions & 1 deletion l10n/de_DE.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@

OC.L10N.register(
"thesearchpage",
{
"The Search Page" : "Die Suchseite"
"The Search Page": "Die Suchseite",
"Provides a proper search page": "Bietet eine richtige Suchseite an",
"All providers": "Alle Anbieter​",
"Back": "Zurück",
"Clear current query": "Aktuelle Abfrage löschen",
"Click to change providers": "Hier klicken um Anbieter zu wechseln",
"Filters": "Filter",
"Load more...": "Weitere laden…",
"Loading...": "Lade…",
"No results": "Keine Ergebnisse",
"Search": "Suche",
"Search Page": "Suchseite",
"See all providers": "Alle Anbieter anzeigen",
"See only results for this provider": "Nur Ergebnisse für diesen Anbieter anzeigen",
"Show only": "Nur anzeigen",
"There was an error loading the providers.": "Beim Laden der Anbieter ist ein Fehler aufgetreten."
},
"nplurals=2; plural=(n != 1);");
20 changes: 18 additions & 2 deletions l10n/de_DE.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@

{ "translations": {
"The Search Page" : "Die Suchseite"
"The Search Page": "Die Suchseite",
"Provides a proper search page": "Bietet eine richtige Suchseite an",
"All providers": "Alle Anbieter​",
"Back": "Zurück",
"Clear current query": "Aktuelle Abfrage löschen",
"Click to change providers": "Hier klicken um Anbieter zu wechseln",
"Filters": "Filter",
"Load more...": "Weitere laden…",
"Loading...": "Lade…",
"No results": "Keine Ergebnisse",
"Search": "Suche",
"Search Page": "Suchseite",
"See all providers": "Alle Anbieter anzeigen",
"See only results for this provider": "Nur Ergebnisse für diesen Anbieter anzeigen",
"Show only": "Nur anzeigen",
"There was an error loading the providers.": "Beim Laden der Anbieter ist ein Fehler aufgetreten."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
}
22 changes: 22 additions & 0 deletions l10n/fr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

OC.L10N.register(
"thesearchpage",
{
"The Search Page": "Page de recherche",
"Provides a proper search page": "Fournit une page de recherche",
"All providers": "Tous les fournisseurs",
"Back": "Retour",
"Clear current query": "Effacer la recherche courante",
"Click to change providers": "Cliquer pour changer les fournisseurs",
"Filters": "Filtres",
"Load more...": "Charger plus...",
"Loading...": "Chargement...",
"No results": "Aucun résultat",
"Search": "Rechercher",
"Search Page": "Page de recherche",
"See all providers": "Voir tous les fournisseurs",
"See only results for this provider": "Voir seulement les résultats de ce fournisseur",
"Show only": "Isoler",
"There was an error loading the providers.": "Il y a eu une erreur au chargement de la liste des fournisseurs"
},
"nplurals=2; plural=(n != 1);");
20 changes: 20 additions & 0 deletions l10n/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

{ "translations": {
"The Search Page": "Page de recherche",
"Provides a proper search page": "Fournit une page de recherche",
"All providers": "Tous les fournisseurs",
"Back": "Retour",
"Clear current query": "Effacer la recherche courante",
"Click to change providers": "Cliquer pour changer les fournisseurs",
"Filters": "Filtres",
"Load more...": "Charger plus...",
"Loading...": "Chargement...",
"No results": "Aucun résultat",
"Search": "Rechercher",
"Search Page": "Page de recherche",
"See all providers": "Voir tous les fournisseurs",
"See only results for this provider": "Voir seulement les résultats de ce fournisseur",
"Show only": "Isoler",
"There was an error loading the providers.": "Il y a eu une erreur au chargement de la liste des fournisseurs"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
22 changes: 22 additions & 0 deletions l10n/tr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

OC.L10N.register(
"thesearchpage",
{
"The Search Page": "Arama sayfası",
"Provides a proper search page": "Düzgün bir arama sayfası sağlar",
"All providers": "Tüm hizmet sağlayıcıları",
"Back": "Geri",
"Clear current query": "Geçerli sorguyu temizle",
"Click to change providers": "Hizmet sağlayıcıları değiştirmek için tıklayın",
"Filters": "Süzgeçler",
"Load more...": "Diğerlerini yükle...",
"Loading...": "Yükleniyor...",
"No results": "Herhangi bir sonuç bulunamadı",
"Search": "Ara",
"Search Page": "Arama sayfası",
"See all providers": "Tüm hizmet sağlayıcıları görüntüle",
"See only results for this provider": "Yalnızca bu hizmet sağlayıcının sonuçlarını görüntüle",
"Show only": "Yalnızca şunlar görüntülensin",
"There was an error loading the providers.": "Hizmet sağlayıcılar yüklenirken sorun çıktı."
},
"nplurals=2; plural=(n != 1);");
20 changes: 20 additions & 0 deletions l10n/tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

{ "translations": {
"The Search Page": "Arama sayfası",
"Provides a proper search page": "Düzgün bir arama sayfası sağlar",
"All providers": "Tüm hizmet sağlayıcıları",
"Back": "Geri",
"Clear current query": "Geçerli sorguyu temizle",
"Click to change providers": "Hizmet sağlayıcıları değiştirmek için tıklayın",
"Filters": "Süzgeçler",
"Load more...": "Diğerlerini yükle...",
"Loading...": "Yükleniyor...",
"No results": "Herhangi bir sonuç bulunamadı",
"Search": "Ara",
"Search Page": "Arama sayfası",
"See all providers": "Tüm hizmet sağlayıcıları görüntüle",
"See only results for this provider": "Yalnızca bu hizmet sağlayıcının sonuçlarını görüntüle",
"Show only": "Yalnızca şunlar görüntülensin",
"There was an error loading the providers.": "Hizmet sağlayıcılar yüklenirken sorun çıktı."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
22 changes: 22 additions & 0 deletions l10n/uk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

OC.L10N.register(
"thesearchpage",
{
"The Search Page": "Пошукова сторінка",
"Provides a proper search page": "Надає результати пошуку",
"All providers": "Все",
"Back": "Назад",
"Clear current query": "Очистити поточний запит",
"Click to change providers": "Клацніть, щоб змінити постачальників даних",
"Filters": "Фільтри",
"Load more...": "Більше...",
"Loading...": "Завантаження...",
"No results": "Нічого не знайдено",
"Search": "Пошук",
"Search Page": "Пошук",
"See all providers": "Показати розширені результати пошуку",
"See only results for this provider": "Показати відфільтровані результати пошуку",
"Show only": "Перейти",
"There was an error loading the providers.": "Помилка під час завантаження постачальників даних."
},
"nplurals=2; plural=(n != 1);");
20 changes: 20 additions & 0 deletions l10n/uk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

{ "translations": {
"The Search Page": "Пошукова сторінка",
"Provides a proper search page": "Надає результати пошуку",
"All providers": "Все",
"Back": "Назад",
"Clear current query": "Очистити поточний запит",
"Click to change providers": "Клацніть, щоб змінити постачальників даних",
"Filters": "Фільтри",
"Load more...": "Більше...",
"Loading...": "Завантаження...",
"No results": "Нічого не знайдено",
"Search": "Пошук",
"Search Page": "Пошук",
"See all providers": "Показати розширені результати пошуку",
"See only results for this provider": "Показати відфільтровані результати пошуку",
"Show only": "Перейти",
"There was an error loading the providers.": "Помилка під час завантаження постачальників даних."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
22 changes: 22 additions & 0 deletions l10n/zh_HK.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

OC.L10N.register(
"thesearchpage",
{
"The Search Page": "搜尋頁面",
"Provides a proper search page": "提供適當的搜尋頁面",
"All providers": "所有提供者",
"Back": "上星期",
"Clear current query": "清除目前的查詢",
"Click to change providers": "點擊以變更提供者",
"Filters": "過濾",
"Load more...": "載入更多…",
"Loading...": "加載中...",
"No results": "沒有結果",
"Search": "搜尋",
"Search Page": "搜尋頁面",
"See all providers": "檢視所有提供者",
"See only results for this provider": "僅檢視該提供者的結果",
"Show only": "僅顯示",
"There was an error loading the providers.": "載入提供者時發生錯誤。"
},
"nplurals=2; plural=(n != 1);");
20 changes: 20 additions & 0 deletions l10n/zh_HK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

{ "translations": {
"The Search Page": "搜尋頁面",
"Provides a proper search page": "提供適當的搜尋頁面",
"All providers": "所有提供者",
"Back": "上星期",
"Clear current query": "清除目前的查詢",
"Click to change providers": "點擊以變更提供者",
"Filters": "過濾",
"Load more...": "載入更多…",
"Loading...": "加載中...",
"No results": "沒有結果",
"Search": "搜尋",
"Search Page": "搜尋頁面",
"See all providers": "檢視所有提供者",
"See only results for this provider": "僅檢視該提供者的結果",
"Show only": "僅顯示",
"There was an error loading the providers.": "載入提供者時發生錯誤。"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
2 changes: 1 addition & 1 deletion lib/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public function getPriority()
// TODO: Implement getPriority() method.
return 50;
}
}
}
Loading

0 comments on commit 9b43a17

Please sign in to comment.