[gnome-keysign: 47/65] bluetooth: add i18n support



commit e1bcac34fbac50f9f014b20a8e2b4a4dbb7ce0a5
Author: RyuzakiKK <aasonykk gmail com>
Date:   Fri Aug 25 12:07:25 2017 +0200

    bluetooth: add i18n support

 keysign/bluetoothoffer.py   | 17 +++++++++--------
 keysign/bluetoothreceive.py |  3 ++-
 2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/keysign/bluetoothoffer.py b/keysign/bluetoothoffer.py
index 5edcc13..17b30cd 100644
--- a/keysign/bluetoothoffer.py
+++ b/keysign/bluetoothoffer.py
@@ -24,6 +24,7 @@ if __name__ == "__main__" and __package__ is None:
     __package__ = str('keysign')
 
 from .gpgmh import get_public_key_data, get_usable_keys
+from .i18n import _
 from .util import get_local_bt_address, mac_generate
 
 log = logging.getLogger(__name__)
@@ -113,11 +114,11 @@ def main(args):
     def _received(result):
         success, error_msg = result
         if success:
-            print("\nKey successfully sent")
+            print(_("\nKey successfully sent"))
         else:
-            print("\nAn error occurred: {}".format(error_msg))
+            print(_("\nAn error occurred: {}").format(error_msg))
         # We are still waiting for the user to press Enter
-        print("Press Enter to exit")
+        print(_("Press Enter to exit"))
 
     key = get_usable_keys(pattern=args[0])[0]
     file_key_data = get_public_key_data(key.fingerprint)
@@ -130,15 +131,15 @@ def main(args):
         code = code.split(";", 1)[0]
         port = data.rsplit("=", 1)[1]
         offer.start().addCallback(_received)
-        print("Offering key: {}".format(key))
-        print("Discovery info: {}".format(code))
-        print("HMAC: {}".format(hmac))
-        print("Port: {}".format(port))
+        print(_("Offering key: {}").format(key))
+        print(_("Discovery info: {}").format(code))
+        print(_("HMAC: {}").format(hmac))
+        print(_("Port: {}").format(port))
         # Wait for the user without blocking everything
         reactor.callInThread(cancel)
         reactor.run()
     else:
-        print("Bluetooth not available")
+        print(_("Bluetooth not available"))
 
 if __name__ == "__main__":
     import sys
diff --git a/keysign/bluetoothreceive.py b/keysign/bluetoothreceive.py
index 0504c53..4f10917 100644
--- a/keysign/bluetoothreceive.py
+++ b/keysign/bluetoothreceive.py
@@ -26,6 +26,7 @@ if __name__ == "__main__" and __package__ is None:
     __package__ = str('keysign')
 
 from .gpgmh import fingerprint_from_keydata
+from .i18n import _
 from .util import mac_verify
 
 log = logging.getLogger(__name__)
@@ -129,7 +130,7 @@ def main(args):
 
         reactor.callFromThread(reactor.stop)
 
-    print("Trying to download the key, please wait")
+    print(_("Trying to download the key, please wait"))
     bt_mac = args[0]
     hmac = args[1]
     port = int(args[2])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]