Skip to content

Commit

Permalink
Merge pull request #192 (add Farsi)
Browse files Browse the repository at this point in the history
Adds Farsi localization, courtesy @HKalbasi
  • Loading branch information
ChanceNCounter authored May 9, 2021
2 parents 49912ba + eca985c commit c5b63e2
Show file tree
Hide file tree
Showing 19 changed files with 1,744 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lingua_franca/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
from lingua_franca import config

_SUPPORTED_LANGUAGES = ("ca", "cs", "da", "de", "en", "es", "fr", "hu",
"it", "nl", "pl", "pt", "sl", "sv")
"it", "nl", "pl", "pt", "sl", "sv", "fa")

_SUPPORTED_FULL_LOCALIZATIONS = ("ca-es", "cs-cz", "da-dk", "de-de",
"en-au", "en-us", "es-es", "fr-fr",
"hu-hu", "it-it", "nl-nl", "pl-pl",
"pt-pt", "ru-ru", "sl-si", "sv-se", "tr-tr")
"fa-ir", "pt-pt", "ru-ru", "sl-si",
"sv-se", "tr-tr")

_DEFAULT_FULL_LANG_CODES = {'ca': 'ca-es',
'cs': 'cs-cz',
'da': 'da-dk',
'de': 'de-de',
'en': 'en-us',
'es': 'es-es',
'fa': 'fa-ir',
'fr': 'fr-fr',
'hu': 'hu-hu',
'it': 'it-it',
Expand Down
115 changes: 115 additions & 0 deletions lingua_franca/lang/common_data_fa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from collections import OrderedDict
from .parse_common import invert_dict

_FUNCTION_NOT_IMPLEMENTED_WARNING = "تابع خواسته شده در زبان فارسی پیاده سازی نشده است."


_FRACTION_STRING_FA = {
2: 'دوم',
3: 'سوم',
4: 'چهارم',
5: 'پنجم',
6: 'ششم',
7: 'هفتم',
8: 'هشتم',
9: 'نهم',
10: 'دهم',
11: 'یازدهم',
12: 'دوازدهم',
13: 'سیزدهم',
14: 'چهاردهم',
15: 'پونزدهم',
16: 'شونزدهم',
17: 'هیفدهم',
18: 'هیجدهم',
19: 'نوزدهم',
20: 'بیستم'
}


_FARSI_ONES = [
"",
"یک",
"دو",
"سه",
"چهار",
"پنج",
"شش",
"هفت",
"هشت",
"نه",
"ده",
"یازده",
"دوازده",
"سیزده",
"چهارده",
"پونزده",
"شونزده",
"هیفده",
"هیجده",
"نوزده",
]

_FARSI_TENS = [
"",
"ده",
"بیست",
"سی",
"چهل",
"پنجاه",
"شصت",
"هفتاد",
"هشتاد",
"نود",
]

_FARSI_HUNDREDS = [
"",
"صد",
"دویست",
"سیصد",
"چهارصد",
"پانصد",
"ششصد",
"هفتصد",
"هشتصد",
"نهصد",
]

_FARSI_BIG = [
'',
'هزار',
'میلیون',
"میلیارد",
'تریلیون',
"تریلیارد",
]


_FORMAL_VARIANT = {
'هفده': 'هیفده',
'هجده': 'هیجده',
'شانزده': 'شونزده',
'پانزده': 'پونزده',
}


_FARSI_FRAC = ["", "ده", "صد"]
_FARSI_FRAC_BIG = ["", "هزار", "میلیونی", "میلیاردی"]

_FARSI_SEPERATOR = ' و '
Loading

0 comments on commit c5b63e2

Please sign in to comment.