Skip to content

Commit

Permalink
Changes encoding style.
Browse files Browse the repository at this point in the history
  • Loading branch information
gguuss authored and danoscarmike committed Jul 31, 2020
1 parent 309f94e commit f8d6fe0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/google-cloud-translate/samples/snippets/snippets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-


# Copyright 2016 Google, Inc.
#
Expand All @@ -27,7 +25,6 @@


from google.cloud import translate
from six import python_2_unicode_compatible


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

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


@python_2_unicode_compatible
def translate_text(target, text):
"""Translates text into the target language.
Expand All @@ -102,7 +98,7 @@ def translate_text(target, text):
# Text can also be a sequence of strings, in which case this method
# will return a sequence of results for each text.
result = translate_client.translate(
unicode(text, 'utf8'),
text.decode('utf-8'),
target_language=target)

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

0 comments on commit f8d6fe0

Please sign in to comment.