Skip to content

Commit 4d10366

Browse files
gguussdanoscarmike
authored andcommitted
Changes encoding style.
1 parent feffa88 commit 4d10366

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

translation/samples/snippets/snippets.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: iso-8859-15 -*-
3-
42

53
# Copyright 2016 Google, Inc.
64
#
@@ -27,7 +25,6 @@
2725

2826

2927
from google.cloud import translate
30-
from six import python_2_unicode_compatible
3128

3229

3330
def detect_language(text):
@@ -80,7 +77,7 @@ def translate_text_with_model(target, text, model=translate.NMT):
8077
# Text can also be a sequence of strings, in which case this method
8178
# will return a sequence of results for each text.
8279
result = translate_client.translate(
83-
text,
80+
text.decode('utf-8'),
8481
target_language=target,
8582
model=model)
8683

@@ -90,7 +87,6 @@ def translate_text_with_model(target, text, model=translate.NMT):
9087
result['detectedSourceLanguage']))
9188

9289

93-
@python_2_unicode_compatible
9490
def translate_text(target, text):
9591
"""Translates text into the target language.
9692
@@ -102,7 +98,7 @@ def translate_text(target, text):
10298
# Text can also be a sequence of strings, in which case this method
10399
# will return a sequence of results for each text.
104100
result = translate_client.translate(
105-
unicode(text, 'utf8'),
101+
text.decode('utf-8'),
106102
target_language=target)
107103

108104
print(u'Text: {}'.format(result['input']))

0 commit comments

Comments
 (0)