谷歌翻译库停止工作。我没有对我的代码做任何修改,它大概在一个小时前就可以工作了。我不明白这是怎么回事。下面是我的代码: from googletrans import Translator
import time
K = Translator()
def anna_sanat(x):
K = Translator()
a = K.translate(x,dest="sv",src="en").text
b = K.translate(x,dest="fi",src="en").text
return [x,a,
我正在试着做一个程序,可以翻译你说的瑞典语,然后PyAutoGUI把它打印出来。但是当我运行代码时,我得到了同样的错误。 trans=Translator()
translating_text=input('Enter text to translate into S w e d i s h:')
t=trans.translate(translating_text,src='en',dest='sv')
time.sleep(5)
translated=t
pyautogui.typewrite(translated)
pyautogui.
我给出了python/django/夹层的第一步,所以请容忍我。
我修改了一个翻译文件并对其进行了编译。
翻译后的文件属于夹层的博客应用程序,我发现唯一可以测试的地方是博客应用程序的地区文件夹(~/MY_VIRTUAL_ENV/lib/python2.7/site-packages/mezzanine/blog/locale/es/LC_MESSAGES).
它运行得很好,但我的勇气告诉我,必须有一种方法可以在我自己的夹层应用程序中的其他位置拥有这个文件,所以:
I can easily maintain it and
I don't have to keep my whole vir
当我尝试用python3安装protobuf时,我输入以下命令
➜ python setup.py build
得到这条恼人的错误信息。
Download error on http://code.google.com/p/google-apputils-python: timed out -- Some packages may not be found!
File "build/bdist.linux-x86_64/egg/google/apputils/app.py", line 95
print 'Try --helpfull to get a lis
似乎gettext无法正确识别替换字段的Python格式字符串,因此不会将其标记为"python- format“。例如。
ugettext("This is a sample format string with a {kwarg}").format(kwarg='key word argument')
然而,gettext正确地识别具有格式说明符的Python串,并用"python- format“标记这样的源串,例如,
ugettext("This is a sample string with a %(format_spec).&
我使用python2.7& django 1.7。
当我使用将我的.po文件翻译成另一种语言(从英语到德语)时,由于在翻译标记中使用了不同的django模板变量,所以会出现许多错误。
我知道机器翻译不是很好,但我只想在测试页面上测试我的翻译字符串。
下面是机器翻译的.po文件从英语(en)翻译成德语(de)的一个典型错误的例子。
#. Translators: {{ site_name_lowercase }} is a variable that does not require translation.
#: .\templates\users\reset_password_ema
我刚刚开始使用Python中的goslate库来检测文本中单词的语言,但在测试了7-8个输入后,我给出了输入,其中的单词写成了两种语言,阿拉伯语和英语。在那之后,它开始给我这个错误。
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
execfile("C:/test_goslate.py");
File "C:/test_goslate.py", line 12, in <module>
我正在尝试在我的django项目中创建messagefile。
为此,我只需将以下代码写入我的home view函数:
def startpage(request):
# Translators: This message appears on the home page only
output = _("Welcome to my site.")
在settings.py中
from django.utils.translation import ugettext_lazy as _
LANGUAGES = [
('de', _('G