forked from organicmaps/organicmaps
Merge pull request #4479 from therearesomewhocallmetim/drop_min_from_locs
Drop min from locs
This commit is contained in:
commit
b624f9f227
32 changed files with 131 additions and 32 deletions
|
@ -973,7 +973,7 @@
|
|||
<!-- For ordering a taxi (as opposed to hotels or other things) -->
|
||||
<string name="taxi_order">Заказать</string>
|
||||
<!-- How long it is until the taxi arrives -->
|
||||
<string name="taxi_wait">Ожидание %d мин</string>
|
||||
<string name="taxi_wait">Ожидание %s</string>
|
||||
<!-- When there are no available taxis nearby -->
|
||||
<string name="taxi_not_found">Не удалось найти такси поблизости</string>
|
||||
<string name="install_app">Установить</string>
|
||||
|
|
|
@ -977,7 +977,7 @@
|
|||
<!-- For ordering a taxi (as opposed to hotels or other things) -->
|
||||
<string name="taxi_order">Order</string>
|
||||
<!-- How long it is until the taxi arrives -->
|
||||
<string name="taxi_wait">Expected in %d min</string>
|
||||
<string name="taxi_wait">Expected in %s</string>
|
||||
<!-- When there are no available taxis nearby -->
|
||||
<string name="taxi_not_found">Couldn\'t find a taxi nearby</string>
|
||||
<string name="install_app">Install</string>
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Заказать";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Ожидание %d мин";
|
||||
"taxi_wait" = "Ожидание %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Не удалось найти такси поблизости";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -1640,7 +1640,7 @@
|
|||
"taxi_order" = "Order";
|
||||
|
||||
/* How long it is until the taxi arrives */
|
||||
"taxi_wait" = "Expected in %d min";
|
||||
"taxi_wait" = "Expected in %s";
|
||||
|
||||
/* When there are no available taxis nearby */
|
||||
"taxi_not_found" = "Couldn't find a taxi nearby";
|
||||
|
|
|
@ -19903,8 +19903,8 @@
|
|||
|
||||
[taxi_wait]
|
||||
comment = How long it is until the taxi arrives
|
||||
en = Expected in %d min
|
||||
ru = Ожидание %d мин
|
||||
en = Expected in %s
|
||||
ru = Ожидание %s
|
||||
|
||||
[taxi_not_found]
|
||||
comment = When there are no available taxis nearby
|
||||
|
|
99
tools/python/po_parser.py
Normal file
99
tools/python/po_parser.py
Normal file
|
@ -0,0 +1,99 @@
|
|||
from __future__ import print_function
|
||||
|
||||
from collections import defaultdict
|
||||
from argparse import ArgumentParser
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
|
||||
|
||||
TRANSFORMATION_TABLE = {
|
||||
"zh_CN": "zh_Hans",
|
||||
"zh_TW": "zh_Hant",
|
||||
"no_NO": "no",
|
||||
"en_GB": "en_GB"
|
||||
}
|
||||
|
||||
|
||||
#msgid
|
||||
#msgstr
|
||||
class PoParser:
|
||||
def __init__(self, folder_path):
|
||||
args = self.parse_args()
|
||||
self.folder_path = args.folder
|
||||
|
||||
all_po_files = self.find_all_po_files()
|
||||
|
||||
|
||||
def find_all_po_files(self):
|
||||
return [
|
||||
f for f in listdir(self.folder_path)
|
||||
if isfile(join(self.folder_path, f)) and f.endswith(".po")
|
||||
]
|
||||
|
||||
|
||||
def parse_files(self):
|
||||
for key, tr in self.translations.iteritems():
|
||||
print(" [{}]\n en = {}".format(key, tr))
|
||||
|
||||
|
||||
def lang_from_filename(self, filename):
|
||||
# strings_ru_RU.po
|
||||
lang = filename[len("strings_"):-len(".po")]
|
||||
|
||||
|
||||
def _parse_one_file(self, filepath):
|
||||
self.translations = defaultdict(str)
|
||||
current_key = None
|
||||
string_started = False
|
||||
with open(filepath) as infile:
|
||||
for line in infile:
|
||||
if line.startswith("msgid"):
|
||||
current_key = self.clean_line(line,"msgid")
|
||||
elif line.startswith("msgstr"):
|
||||
if not current_key:
|
||||
continue
|
||||
translation = self.clean_line(line, "msgstr")
|
||||
if not translation:
|
||||
print("No translation for key {}".format(current_key))
|
||||
continue
|
||||
self.translations[current_key] = translation
|
||||
string_started = True
|
||||
elif not line or line.startswith("#"):
|
||||
string_started = False
|
||||
current_key = None
|
||||
else:
|
||||
if not string_started:
|
||||
continue
|
||||
self.translations[current_key] = "{}{}".format(self.translations[current_key], self.clean_line(line))
|
||||
|
||||
|
||||
|
||||
|
||||
def clean_line(self, line, prefix=""):
|
||||
return line[len(prefix):].strip().strip('"')
|
||||
|
||||
|
||||
def parse_args(self):
|
||||
parser = ArgumentParser(
|
||||
description="""
|
||||
A script for parsing stirngs in the PO format, which is used by our
|
||||
translation partners.
|
||||
"""
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-f", "--folder",
|
||||
dest="folder", required=True,
|
||||
help="""Path to the folder where the PO files are. Required."""
|
||||
)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
# parser = PoParser("en.po", "en")
|
||||
# for key, tr in parser.translations.iteritems():
|
||||
# print(" [{}]\n en = {}".format(key, tr))
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Reference in a new issue