Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行错误好像是小括号的问题 #3

Open
Z-figaro opened this issue May 13, 2018 · 10 comments
Open

运行错误好像是小括号的问题 #3

Z-figaro opened this issue May 13, 2018 · 10 comments

Comments

@Z-figaro
Copy link

_compile
raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis

@onezens
Copy link
Owner

onezens commented May 14, 2018

  1. python 版本: python -V
  2. 将这个路径替换成你电脑中需要国际化的项目的路径后,在终端cd 到RunScript目录下执行 python AutoGenStrings.py,最后如果报错的话,将终端错误粘贴下

filePath = '/Users/leaf/Documents/git/AutoLocalization/AutoLocalization'

  1. 还有一种就是不用改代码,直接通过 python AutoGenStrings.py {项目的根路径} 运行

@onezens onezens closed this as completed May 14, 2018
@onezens onezens reopened this May 14, 2018
@onezens
Copy link
Owner

onezens commented May 14, 2018

脚本目前只支持python2

@Z-figaro
Copy link
Author

确定是英文格式的小括号问题。我对python 一无所知,请问能遍历一下,修改英文括号为中文括号吗??

@onezens
Copy link
Owner

onezens commented May 14, 2018

是项目路径中有中文括号? 还是需要国际化的控件的值里面有中文括号?

@Z-figaro
Copy link
Author

需要国际化的控件的值,我拿你的demo实测过了;只要有一个,就报错

@onezens
Copy link
Owner

onezens commented May 15, 2018

我测试了下,没有问题,你看能提供些更详细的信息不

"1CH-Bp-ZAa.text" = "【】()(){}.,.,\\/,。'\";

@Z-figaro
Copy link
Author

Traceback (most recent call last):
File "/Users/zhangpeng/Desktop/StarBridgeChain/StarBridgeChain/RunScript/AutoGenStrings.py", line 240, in
main()
File "/Users/zhangpeng/Desktop/StarBridgeChain/StarBridgeChain/RunScript/AutoGenStrings.py", line 222, in main
generateLocalizableFiles(upperFilePath, sourceFilePathName)
File "/Users/zhangpeng/Desktop/StarBridgeChain/StarBridgeChain/RunScript/AutoGenStrings.py", line 178, in generateLocalizableFiles
compareWithFilePath(tempFile_Path,targetPath)
File "/Users/zhangpeng/Desktop/StarBridgeChain/StarBridgeChain/RunScript/AutoGenStrings.py", line 92, in compareWithFilePath
anotationString = getAnotationOfString(newString_txt,linestr)
File "/Users/zhangpeng/Desktop/StarBridgeChain/StarBridgeChain/RunScript/AutoGenStrings.py", line 72, in getAnotationOfString
anotationMatch = re.search(anotationRegex,string_txt)
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 146, in search
return _compile(pattern, flags).search(string)
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis
Command /bin/sh failed with exit code 1

@Z-figaro
Copy link
Author

在根目录生成了一个 名字叫TempfileOfStoryboardNew.strings 的文件

@Z-figaro
Copy link
Author

utf-16/UCS-2,big endian
can not recognize!

我发现这个问题,现在xcode的编码是不是变了??

@Z-figaro
Copy link
Author

我的是xcode Version 9.3.1 (9E501)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants