-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add infrastructure for crowdsourcing internationalization project
ready to build GeoDa with new Chinese language package
- Loading branch information
Showing
25 changed files
with
21,459 additions
and
6,620 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
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
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
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
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
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
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
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,4 @@ | ||
#!/bin/bash | ||
# create_geoda_pot.sh | ||
# the first part will use find() command to find _() strings from | ||
find .. \( -name '*.cpp' -o -name '*.h' \) -not -path "../BuildTools/*" | xargs xgettext -d geoda -s --keyword=_ -p ./ -o geoda.pot |
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
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,44 @@ | ||
#!/usr/bin/python | ||
|
||
from __future__ import print_function | ||
import re | ||
import csv | ||
import sys | ||
import argparse | ||
from po2csv import po2dict, dict2PO | ||
|
||
def getDiffPO(po_file, all_items): | ||
new_items = {} | ||
|
||
# read from po_file | ||
current_items = {} | ||
po2dict(po_file, current_items) | ||
|
||
# use all_items as ground to find diff (than po_file) | ||
msgid_list = all_items.keys() | ||
for msgid in msgid_list: | ||
if msgid not in current_items: | ||
new_items[msgid] = all_items[msgid] | ||
|
||
return new_items | ||
|
||
|
||
parser = argparse.ArgumentParser(description='Get new items by comparing existing PO file (e.g. zh_CN.po, specified using argument --input) with new POT files (geoda.pot and xrc.pot extracted from source code). New msgid with empty msgstr will be written into a new PO file specified by argument --output') | ||
parser.add_argument('pot_files', type=str, nargs='+', help='paths of template POT files') | ||
parser.add_argument('--input', required=True, dest='input_po_file', type=str, help='path of an existing to-be-updated po_file') | ||
parser.add_argument('--output', required=True, dest='output_po_file', help='path of an output po_file') | ||
args = parser.parse_args() | ||
|
||
if __name__ == "__main__": | ||
pot_files = args.pot_files | ||
exist_po = args.input_po_file | ||
output_po = args.output_po_file | ||
|
||
# construct a dictionary from all POT file, | ||
# so that newly added msgid will be included | ||
all_items = {} | ||
for pot in pot_files: | ||
po2dict(pot, all_items) | ||
|
||
new_items = getDiffPO(exist_po, all_items) | ||
dict2PO(new_items, output_po) |
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,44 @@ | ||
#!/usr/bin/python | ||
|
||
from __future__ import print_function | ||
import re | ||
import csv | ||
import sys | ||
import argparse | ||
from po2csv import po2dict, dict2PO | ||
|
||
def updatePO(po_file, all_items): | ||
new_items = all_items.copy() | ||
|
||
# read from po_file | ||
current_items = {} | ||
po2dict(po_file, current_items) | ||
|
||
# use all_items as ground | ||
msgid_list = all_items.keys() | ||
for msgid in msgid_list: | ||
if msgid in current_items: | ||
new_items[msgid] = current_items[msgid] | ||
|
||
return new_items | ||
|
||
|
||
parser = argparse.ArgumentParser(description='Update existing PO file (e.g. zh_CN.po, specified using argument --input) using POT files (geoda.pot and xrc.pot extracted from source code. New msgid with empty msgstr will be added into existing PO file and saved into a new file specified by argument --output') | ||
parser.add_argument('pot_files', type=str, nargs='+', help='paths of template POT files') | ||
parser.add_argument('--input', required=True, dest='input_po_file', type=str, help='path of an existing to-be-updated po_file') | ||
parser.add_argument('--output', required=True, dest='output_po_file', help='path of an output po_file') | ||
args = parser.parse_args() | ||
|
||
if __name__ == "__main__": | ||
pot_files = args.pot_files | ||
exist_po = args.input_po_file | ||
output_po = args.output_po_file | ||
|
||
# construct a dictionary from all POT file, | ||
# so that newly added msgid will be included | ||
all_items = {} | ||
for pot in pot_files: | ||
po2dict(pot, all_items) | ||
|
||
all_items = updatePO(exist_po, all_items) | ||
dict2PO(all_items, output_po) |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
{"installed":{"client_id":"911148186542-n9brf1e9bh4vq07229n3d604t8kenodr.apps.googleusercontent.com","project_id":"quickstart-1557874589303","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"tSA4X8GKgSwkkgPCck5xgzof","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}} |
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,27 @@ | ||
#!/usr/bin/python | ||
|
||
from __future__ import print_function | ||
import re | ||
import sys | ||
|
||
def csv2po(csv_file, po_file): | ||
with open(csv_file) as f, open(po_file, 'w') as o: | ||
for i, line in enumerate(f, 1): | ||
if (i == 0): | ||
continue | ||
line = line.strip() | ||
if (len(line) == 0): | ||
continue | ||
msgid, msgstr, contrib = line.split('`') | ||
line = 'msgid "' + msgid + '"\n' | ||
o.write(line) | ||
line = 'msgstr "' + msgstr + '"\n' | ||
o.write(line) | ||
|
||
if __name__ == "__main__": | ||
if (len(sys.argv) != 3) : | ||
print("Usage: python csv2po.py csv_file po_file") | ||
else: | ||
csv_file, po_file = sys.argv[1:] | ||
if (po_file and csv_file): | ||
csv2po(csv_file, po_file) |
Oops, something went wrong.