forked from darkskyapp/translations
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4dfe57
commit f171b19
Showing
12 changed files
with
2,008 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[lint] | ||
|
||
ignore = [ | ||
"F601", # Duplicate literal | ||
] | ||
|
||
[lint.flake8-pytest-style] | ||
fixture-parentheses = false | ||
|
||
[lint.pyupgrade] | ||
keep-runtime-typing = true | ||
|
||
[lint.mccabe] | ||
max-complexity = 25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
def join_with_shared_prefix(a, b, joiner): | ||
if a[:4] == "يوم " and b[:4] == "يوم " and joiner == " و ": | ||
return "يومي " + a[4:] + joiner + b[4:] | ||
else: | ||
return a + joiner + b | ||
|
||
|
||
def strip_prefix(period): | ||
if period[:10] == "خلال الليل": | ||
return period[5:] | ||
elif period[:3] == "في ": | ||
return period[3:] | ||
else: | ||
return period | ||
|
||
|
||
def and_function(stack, a, b): | ||
return join_with_shared_prefix(a, b, " و ") | ||
|
||
|
||
def through_function(stack, a, b): | ||
return join_with_shared_prefix(a, b, " حتى ") | ||
|
||
|
||
def parenthetical_function(stack, a, b): | ||
return a + " (" + b + (" من الثلج)" if a == "هطول أمطار وثلوج" else ")") | ||
|
||
|
||
def until_function(stack, condition, period): | ||
return condition + " حتى " + strip_prefix(period) | ||
|
||
|
||
def until_starting_again_function(stack, condition, a, b): | ||
return condition + " حتى " + strip_prefix(a) + " وتبدأ مجدداً في " + strip_prefix(b) | ||
|
||
|
||
def starting_continuing_until_function(stack, condition, a, b): | ||
return condition + " تبدأ في " + strip_prefix(a) + " وتستمر حتى " + strip_prefix(b) | ||
|
||
|
||
template = { | ||
"clear": "صافِ", | ||
"no-precipitation": "لا أمطار", | ||
"mixed-precipitation": "هطول أمطار وثلوج", | ||
"possible-very-light-precipitation": "إحتمالية هطول أمطار خفيفة", | ||
"very-light-precipitation": "أمطار خفيفة", | ||
"possible-light-precipitation": "إحتمالية هطول أمطار خفيفة", | ||
"light-precipitation": "أمطار خفيفة", | ||
"medium-precipitation": "أمطار متوسطة", | ||
"heavy-precipitation": "أمطار غزيرة", | ||
"possible-very-light-rain": "إحتمالية هطول أمطار خفيفة", | ||
"very-light-rain": "أمطار خفيفة", | ||
"possible-light-rain": "إحتمالية أمطار خفيفة", | ||
"light-rain": "أمطار خفيفة", | ||
"medium-rain": "أمطار متوسطة", | ||
"heavy-rain": "أمطار غزيرة", | ||
"possible-very-light-sleet": "إحتمالية موجة صقيع خفيفة", | ||
"very-light-sleet": "موجة صقيع خفيفة", | ||
"possible-light-sleet": "إحتمالية موجة صقيع خفيفة", | ||
"light-sleet": "موجة صقيع خفيفة", | ||
"medium-sleet": "صقيع", | ||
"heavy-sleet": "موجة صقيع شديدة", | ||
"possible-very-light-snow": "احتمالية تساقط ثلوج خفيفة", | ||
"very-light-snow": "رياح خفيفة", | ||
"possible-light-snow": "احتمالية تساقط ثلوج خفيفة", | ||
"light-snow": "ثلوج خفيفة", | ||
"medium-snow": "ثلوج", | ||
"heavy-snow": "ثلوج كثيفة", | ||
"possible-thunderstorm": "عواصف محتملة", | ||
"thunderstorm": "عواصف", | ||
"possible-medium-precipitation": "هطول الأمطار المحتمل", | ||
"possible-heavy-precipitation": "هطول الأمطار الغزيرة المحتملة", | ||
"possible-medium-rain": "أمطار محتملة", | ||
"possible-heavy-rain": "أمطار غزيرة محتملة", | ||
"possible-medium-sleet": "صقيع محتمل", | ||
"possible-heavy-sleet": "أمطار ثلجية غزيرة محتملة", | ||
"possible-medium-snow": "ثلوج محتملة", | ||
"possible-heavy-snow": "ثلوج كثيفة محتملة", | ||
"possible-freezing-drizzle": "رذاذ متجمد محتمل", | ||
"freezing-drizzle": "رذاذ متجمد", | ||
"possible-light-freezing-rain": "أمطار خفيفة متجمدة خفيفة محتملة", | ||
"light-freezing-rain": "أمطار متجمدة خفيفة", | ||
"possible-freezing-rain": "أمطار متجمدة محتملة", | ||
"freezing-rain": "أمطار متجمدة", | ||
"possible-heavy-freezing-rain": "أمطار متجمدة غزيرة محتملة", | ||
"heavy-freezing-rain": "أمطار متجمدة غزيرة", | ||
"possible-hail": "بَرَد محتمل", | ||
"hail": "البَرَد", | ||
"light-wind": "رياح خفيفة", | ||
"medium-wind": "رياح متوسطة", | ||
"heavy-wind": "عواصف", | ||
"low-humidity": "اجواء جافة", | ||
"high-humidity": "اجواء رطبة", | ||
"fog": "اجواء غائمة", | ||
"very-light-clouds": "واضح في الغالب", | ||
"light-clouds": "غائم جزئياً", | ||
"medium-clouds": "اجواء غائمة", | ||
"heavy-clouds": "اجواء غائمة", | ||
"today-morning": "هذا الصباح", | ||
"later-today-morning": "لاحقاً هذا الصباح", | ||
"today-afternoon": "بعد الظهر", | ||
"later-today-afternoon": "لاحقاً بعد الظهر", | ||
"today-evening": "هذا المساء", | ||
"later-today-evening": "لاحقاً هذا المساء", | ||
"today-night": "الليلة", | ||
"later-today-night": "لاحقاً الليلة", | ||
"tomorrow-morning": "الغد صباحاً", | ||
"tomorrow-afternoon": "غداً بعد الظهر", | ||
"tomorrow-evening": "الغد مساءً", | ||
"tomorrow-night": "الغد ليلاً", | ||
"morning": "في الصباح", | ||
"afternoon": "بعد الظهيرة", | ||
"evening": "في المساء", | ||
"night": "خلال الليل", | ||
"today": "اليوم", | ||
"tomorrow": "غداً", | ||
"sunday": "يوم الأحد", | ||
"monday": "يوم الإثنين", | ||
"tuesday": "يوم الثلاثاء", | ||
"wednesday": "يوم الأربعاء", | ||
"thursday": "يوم الخميس", | ||
"friday": "يوم الجمعة", | ||
"saturday": "يوم السبت", | ||
"next-sunday": "الأحد القادم", | ||
"next-monday": "الإثنين القادم", | ||
"next-tuesday": "الثلاثاء القادم", | ||
"next-wednesday": "الأربعاء القادم", | ||
"next-thursday": "الخميس القادم", | ||
"next-friday": "الجمعة القادمة", | ||
"next-saturday": "السبت القادم", | ||
"minutes": "$1 دقيقة", | ||
"fahrenheit": "$1\u00b0F", | ||
"celsius": "$1\u00b0C", | ||
"inches": "$1 انش", | ||
"centimeters": "$1 سم", | ||
"less-than": "أقل من $1", | ||
"and": and_function, | ||
"through": through_function, | ||
"with": "$1 مع $2", | ||
"range": "$1\u2013$2", | ||
"parenthetical": parenthetical_function, | ||
"for-hour": "$1 لهذه الساعة", | ||
"starting-in": "$1 تبدأ خلال $2", | ||
"stopping-in": "$1 تتوقف خلال $2", | ||
"starting-then-stopping-later": "$1 تبدأ خلال $2 وتتوقف لاحقاً خلال $3", | ||
"stopping-then-starting-later": "$1 تتوقف خلال $2 وتبدأ لاحقاً خلال $3", | ||
"for-day": "$1 خلال اليوم", | ||
"starting": "$1 تبدأ $2", | ||
"until": until_function, | ||
"until-starting-again": until_starting_again_function, | ||
"starting-continuing-until": starting_continuing_until_function, | ||
"during": "$1 $2", | ||
"for-week": "$1 خلال الأسبوع", | ||
"over-weekend": "$1 خلال نهاية الأسبوع", | ||
"temperatures-peaking": "درجات حرارة تبلغ ذروتها عند $1 $2", | ||
"temperatures-rising": "درجات حرارة ترتفع حتى $1 $2", | ||
"temperatures-valleying": "انخفاض درجات الحرارة لأدنى مستوى لها عند $1 $2", | ||
"temperatures-falling": "درجات حرارة تنخفض حتى $1 $2", | ||
"title": "$1", | ||
"sentence": "$1", | ||
"next-hour-forecast-status": "next hour forecasts are $1 due to $2", | ||
"unavailable": "unavailable", | ||
"temporarily-unavailable": "temporarily unavailable", | ||
"partially-unavailable": "partially unavailable", | ||
"station-offline": "all nearby radar stations being offline", | ||
"station-incomplete": "gaps in coverage from nearby radar stations", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
import re | ||
|
||
|
||
def custom_capitalize(s): | ||
return s[0].upper() + s[1:] if s else s | ||
|
||
|
||
def and_function(stack, a, b): | ||
return a + " və " + b | ||
|
||
|
||
def through_function(stack, a, b): | ||
return a + " ilə " + b + " arası" | ||
|
||
|
||
def parenthetical_function(stack, a, b): | ||
return f'{a} ({b}{" qar)" if a == "qarışıq yağış" else ")"}' | ||
|
||
|
||
def until_function(stack, condition, period): | ||
return condition + " " + period + " dayanacaq" | ||
|
||
|
||
def until_starting_again_function(stack, condition, a, b): | ||
return condition + " " + a + " dayanıb, " + b + " yenidən başlayacaq" | ||
|
||
|
||
def starting_continuing_until_function(stack, condition, a, b): | ||
return a + " " + condition + " başlayıb, " + b + " dayanacaq" | ||
|
||
|
||
def title_function(stack, s): | ||
# Apply custom_capitalize to every word | ||
def replace_func(txt: str) -> str: | ||
if txt in {"və", "düym", "sm."}: | ||
return txt | ||
return txt[0].upper() + txt[1:].lower() | ||
|
||
# Use regex to find all words with the specified letters | ||
return re.sub(r"([a-zA-ZÇ窺IıƏəÖöĞğÜü.]+)", lambda m: replace_func(m.group(0)), s) | ||
|
||
|
||
def sentence_function(stack, s): | ||
s = custom_capitalize(s) | ||
if not s.endswith("."): | ||
s += "." | ||
return s | ||
|
||
|
||
template = { | ||
"clear": "buludsuz", | ||
"no-precipitation": "yağmursuz", | ||
"mixed-precipitation": "qarışıq yağış", | ||
"possible-very-light-precipitation": "yüngül yağış ehtimalı", | ||
"very-light-precipitation": "yüngül yağış", | ||
"possible-light-precipitation": "yüngül yağış ehtimalı", | ||
"light-precipitation": "yüngül yağış", | ||
"medium-precipitation": "yağış", | ||
"heavy-precipitation": "güclü yağış", | ||
"possible-very-light-rain": "çiskin yağış ehtimalı", | ||
"very-light-rain": "çiskin", | ||
"possible-light-rain": "yüngül yağış ehtimalı", | ||
"light-rain": "yüngül yağış", | ||
"medium-rain": "yağış", | ||
"heavy-rain": "güclü yağış", | ||
"possible-very-light-sleet": "yüngül sulu qar ehtimalı", | ||
"very-light-sleet": "yüngül sulu qar", | ||
"possible-light-sleet": "yüngül sulu qar ehtimalı", | ||
"light-sleet": "yüngül sulu qar", | ||
"medium-sleet": "sulu qar", | ||
"heavy-sleet": "güclü sulu qar", | ||
"possible-very-light-snow": "sulu qar ehtimalı", | ||
"very-light-snow": "sulu qar", | ||
"possible-light-snow": "yüngül qar ehtimalı", | ||
"light-snow": "yüngül qar", | ||
"medium-snow": "qar", | ||
"heavy-snow": "güclü qar", | ||
"possible-thunderstorm": "mümkün tufanlar", | ||
"thunderstorm": "tufanlar", | ||
"possible-medium-precipitation": "mümkün yağıntı", | ||
"possible-heavy-precipitation": "mümkün ağır yağış", | ||
"possible-medium-rain": "mümkün yağış", | ||
"possible-heavy-rain": "mümkün güclü yağış", | ||
"possible-medium-sleet": "mümkün sulu qar", | ||
"possible-heavy-sleet": "mümkün ağır sulu qar", | ||
"possible-medium-snow": "mümkün qar", | ||
"possible-heavy-snow": "mümkün güclü qar", | ||
"possible-freezing-drizzle": "mümkün donma çiskin", | ||
"freezing-drizzle": "donmaq çiskin", | ||
"possible-light-freezing-rain": "mümkün işıq donması yağış", | ||
"light-freezing-rain": "yüngül donmuş yağış", | ||
"possible-freezing-rain": "mümkün donma yağışı", | ||
"freezing-rain": "donmuş yağış", | ||
"possible-heavy-freezing-rain": "mümkün güclü donmuş yağış", | ||
"heavy-freezing-rain": "güclü donmuş yağış", | ||
"possible-hail": "mümkün dolu", | ||
"hail": "dolu", | ||
"light-wind": "sərin", | ||
"medium-wind": "külək", | ||
"heavy-wind": "güclü külək", | ||
"low-humidity": "rütubətsiz", | ||
"high-humidity": "rütubətli", | ||
"fog": "dumanlı", | ||
"very-light-clouds": "əsasən buludsuz", | ||
"light-clouds": "qismən buludlu", | ||
"medium-clouds": "əsasən buludlu", | ||
"heavy-clouds": "tutqun hava", | ||
"today-morning": "bu gün səhər", | ||
"later-today-morning": "bu gün səhərdən sonra", | ||
"today-afternoon": "bu gün günortadan sonra", | ||
"later-today-afternoon": "bu gün günortadan sonra", | ||
"today-evening": "bu gün axşam", | ||
"later-today-evening": "bu gün axşam", | ||
"today-night": "bu gün gecə", | ||
"later-today-night": "bu gün gecə", | ||
"tomorrow-morning": "sabah səhər", | ||
"tomorrow-afternoon": "sabah günortadan sonra", | ||
"tomorrow-evening": "sabah axşam", | ||
"tomorrow-night": "sabah gecə", | ||
"morning": "səhər", | ||
"afternoon": "günortadan sonra", | ||
"evening": "axşam", | ||
"night": "gecə", | ||
"today": "bu gün", | ||
"tomorrow": "sabah", | ||
"sunday": "bazar günü", | ||
"monday": "bazar ertəsi", | ||
"tuesday": "çərşənbə axşamı", | ||
"wednesday": "çərşənbə günü", | ||
"thursday": "cümə axşamı", | ||
"friday": "cümə günü", | ||
"saturday": "şənbə günü", | ||
"next-sunday": "bazar günü", | ||
"next-monday": "bazar ertəsi", | ||
"next-tuesday": "çərşənbə axşamı", | ||
"next-wednesday": "çərşənbə günü", | ||
"next-thursday": "cümə axşamı", | ||
"next-friday": "cümə günü", | ||
"next-saturday": "şənbə günü", | ||
"minutes": "$1 dəq.", | ||
"fahrenheit": "$1\u00b0F", | ||
"celsius": "$1\u00b0C", | ||
"inches": "$1 düym", | ||
"centimeters": "$1 sm.", | ||
"less-than": "$1-dən aşağı", | ||
"and": and_function, | ||
"through": through_function, | ||
"with": "$1, $2", | ||
"range": "$1\u2013$2", | ||
"parenthetical": parenthetical_function, | ||
"for-hour": "1 saat boyunca $1 olacaq", | ||
"starting-in": "$2 sonra $1 başlayacaq", | ||
"stopping-in": "$1 $2 sonra dayanacaq", | ||
"starting-then-stopping-later": "$1 $2 sonra başlayacaq, $3 davam edib dayanacaq", | ||
"stopping-then-starting-later": "$1 $2 sonra dayanacaq, $3 sonra yenidən başlayacaq", | ||
"for-day": "gün boyu $1 olacaq", | ||
"starting": "$2 $1 başlayacaq", | ||
"until": until_function, | ||
"until-starting-again": until_starting_again_function, | ||
"starting-continuing-until": starting_continuing_until_function, | ||
"during": "$2 $1 olacaq", | ||
"for-week": "həftə boyunca $1 olacaq", | ||
"over-weekend": "həftə sonu $1 olacaq", | ||
"temperatures-peaking": "$2 hava kəskin istiləşəcək və temperatur $1-yə qalxacaq", | ||
"temperatures-rising": "$2 temperatur $1-yə qalxacaq", | ||
"temperatures-valleying": "$2 hava kəskin soyuyacaq və temperatur $1-yə düşəcək", | ||
"temperatures-falling": "$2 temperatur $1-yə düşəcək", | ||
"title": title_function, | ||
"sentence": sentence_function, | ||
"next-hour-forecast-status": "next hour forecasts are $1 due to $2", | ||
"unavailable": "unavailable", | ||
"temporarily-unavailable": "temporarily unavailable", | ||
"partially-unavailable": "partially unavailable", | ||
"station-offline": "all nearby radar stations being offline", | ||
"station-incomplete": "gaps in coverage from nearby radar stations", | ||
} |
Oops, something went wrong.