Created
July 20, 2017 12:22
-
-
Save DrMartiner/77d2c19f371eed96c4ac3b466ee823e1 to your computer and use it in GitHub Desktop.
Put po files to shuup project
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
import os | |
import shutil | |
SHUUP_PATH = '~/.pyenv/versions/project/lib/python3.5/site-packages/shuup' | |
SOURCE_PATH = '~/projects/project' | |
for file_name in os.listdir(SOURCE_PATH): | |
m = re.match('^for_use_shuup_(.*)_ru.po$', file_name) | |
if m: | |
parts = m.group(1).split('-') | |
cur_path = os.path.join( | |
SHUUP_PATH, *parts, 'locale', 'ru', 'LC_MESSAGES' | |
) | |
if not os.path.exists(cur_path): | |
os.makedirs(cur_path) | |
src_path = os.path.join(SOURCE_PATH, file_name) | |
dst_path = os.path.join(cur_path, 'django.po') | |
shutil.copy(src_path, dst_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment