Changeset View
Changeset View
Standalone View
Standalone View
./source/tools/i18n/pullTranslations.py
#!/usr/bin/env python2 | #!/usr/bin/env python | ||||
# -*- coding:utf-8 -*- | # -*- coding:utf-8 -*- | ||||
# | # | ||||
# Copyright (C) 2014 Wildfire Games. | # Copyright (C) 2014 Wildfire Games. | ||||
Context not available. | |||||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||
# along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | # along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
""" | |||||
Although this script itself should work with both Python 2 and Python 3, it relies on the Transifex Client, which at | |||||
this moment (2014-10-23) does not support Python 3 in the latest stable release (0.10). | |||||
As soon as Transifex Client supports Python 3, simply updating its folder should be enough to make this script work | |||||
with Python 3 as well. | |||||
""" | |||||
from __future__ import absolute_import, division, print_function, unicode_literals | from __future__ import absolute_import, division, print_function, unicode_literals | ||||
import os, sys | import os, sys | ||||
# Python version check. | |||||
if sys.version_info[0] != 2: | |||||
print(__doc__) | |||||
sys.exit() | |||||
from txclib.project import Project | from txclib.project import Project | ||||
Context not available. | |||||
transifexClientFolder = ".tx" | transifexClientFolder = ".tx" | ||||
for root, folders, filenames in os.walk(projectRootDirectory): | for root, folders, filenames in os.walk(projectRootDirectory): | ||||
root = root.decode('utf-8') | if sys.version_info[0] == 2: | ||||
root = root.decode('utf-8') | |||||
for folder in folders: | for folder in folders: | ||||
if folder == l10nFolderName: | if folder == l10nFolderName: | ||||
if os.path.exists(os.path.join(root, folder, transifexClientFolder)): | if os.path.exists(os.path.join(root, folder, transifexClientFolder)): | ||||
Context not available. |
Wildfire Games · Phabricator