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

單行內容不需要 \n 結尾 #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

toomore
Copy link

@toomore toomore commented Feb 4, 2015

Hi @chai2010 單行的內容似乎不需要 \n 結尾,這是我的修正,再請您幫忙 review,感謝!

~Toomore

@chai2010
Copy link
Owner

chai2010 commented Feb 5, 2015

@toomore 感谢你的反馈.

在 po 中2种概念的换行:

  1. po源文件自己的换行, 比如"abc"\n, 这个只和po源码的书写风格有关系
  2. po字符串被加载到程序中后在程序运行状态下的换行, 比如: "abc\n".

我不太清楚你的说具体是哪种状态.

PS:
当然, gettext-go 本身处理也有点混乱, 而且缺少足够测试代码...

@toomore
Copy link
Author

toomore commented Feb 5, 2015

@chai2010 對不起沒有說明清楚,我是在做簡單的讀取 po、新增字詞、儲存 po 這樣的流程[1],但是這樣儲存之後每個 msgid, msdstr 的字詞內結尾會多出字串 "\n",像是:

原始 po:

msgid "Toomore"
msgstr "MsgToomore"

儲存後:

msgid "Toomore\n"
msgstr "MsgToomore\n"

我想這只有一行的詞應該不需要放入一個 "\n" 字在字詞結尾中,這樣好像和原本的 msgid 是不同的(或許我誤解),再麻煩你了,感謝!

[1] https://github.com/toomore/onesky/blob/master/gettext-go/main.go

@chai2010
Copy link
Owner

chai2010 commented Feb 5, 2015

恩, 这样看应该是一个BUG,
因为增加的\n改变了原始的运行时字符串的值.

你能添加一个针对这个BUG的test函数吗?
(可以先创建一个issues, 然后创建对应issues编号的测试, 比如"TestIssueN")

@toomore
Copy link
Author

toomore commented Feb 5, 2015

Hi @chai2010 我加入了 testing 和一些修正,再麻煩你 review,感謝!

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

Successfully merging this pull request may close these issues.

2 participants