小编art*_*hur的帖子

一些字符串未在django i18n模块中翻译

我对django的国际化模块有一些奇怪的麻烦.大多数字符串都是必须翻译的,而其他字符串则不是.让我告诉你和例子:

<li>{% trans "Upload Score" %}</li>
<li>{% trans "Profile" %}</li>
<li>{% trans "Invite friends" %}</li>
<li>{% trans "Settings" %}</li>
Run Code Online (Sandbox Code Playgroud)

我有一个菜单列表4项.我运行django命令makemessages用法语翻译网站,我得到了所有的预期:

#: templates/main.html:190 templates/main.html.py:195
#, fuzzy
msgid "Upload Score"
msgstr "Publier"

#: templates/main.html:191 templates/main.html.py:196
msgid "Profile"
msgstr "Profil"

#: templates/main.html:192 templates/main.html.py:197
#, fuzzy
msgid "Invite Friends"
msgstr "inviter vos amis"

#: templates/main.html:193 templates/main.html.py:198
msgid "Settings"
msgstr "Préférences"
Run Code Online (Sandbox Code Playgroud)

但是当我编译它时,将django-admin compilemessages,只翻译"Profile"和"Settings".你知道它可能来自哪里吗?它可以与白色空间的使用联系起来吗?i18n模块中是否有调试模式?

谢谢你的帮助!:)

编辑:我们在django 1.4.

python django django-i18n

12
推荐指数
1
解决办法
1475
查看次数

Google API会在生产中返回invalid_grant,但不会在本地返回

我在python中使用谷歌API有一个非常奇怪的例外.目标是在服务器端检查与来自Android应用程序的应用内订阅相对应的令牌的有效性.

为此,我们在Google Play帐户中附加了一个服务帐户,我们尝试使用oauth通过p12密钥验证我们的请求(转换为pem证书以删除密码短语):

from apiclient.discovery import build
from httplib2 import Http
from oauth2client.client import SignedJwtAssertionCredentials

with open("googleplay.pem") as f:
    private_key = f.read()
credentials = SignedJwtAssertionCredentials(GOOGLE_CLIENT_EMAIL, private_key, scope=['https://www.googleapis.com/auth/androidpublisher'])
http_auth = credentials.authorize(Http())
client = build('androidpublisher', 'v2', http=http_auth)
Run Code Online (Sandbox Code Playgroud)

这在我的电脑上完美运行.但是最后一行在我的服务器上触发了一个异常:invalid_grant

我不明白这可能来自哪里!如果你可以帮助我们,我们会非常棒!

我用来将p12证书转换为pem证书的一些额外代码:

openssl pkcs12 -in privatekey.p12 -nodes -nocerts > privatekey.pem
Run Code Online (Sandbox Code Playgroud)

然后我删除了前4行.

提前致谢!

python google-api google-play-services

10
推荐指数
1
解决办法
213
查看次数

使用 mixpanel JavaScript 客户端取消设置人员属性

我尝试使用 mixpanel JavaScript API 删除用户的属性。正如我所见,只有一个方法集,但没有未设置的方法。我试图用 undefined 或 null 设置属性,但是当我这样做时,该属性仍然存在,没有值。我想完全删除它,因为我们可以使用 mixpanel 界面来完成。那可能吗?

谢谢你的帮助!

一些代码:

// Let set the property 'foo' with a value 'bar' to the current user
mixpanel.people.set("foo", "bar");

// Now, let unset this proprety
// Oops, there is no method unset...
// Let's try something else
mixpanel.people.set("foo"); // nop...
mixpanel.people.set("foo", undefined); // nop...
mixpanel.people.set("foo", null); // the value is now empty but the property still exists
Run Code Online (Sandbox Code Playgroud)

javascript mixpanel

5
推荐指数
1
解决办法
704
查看次数