001-translation.py 504 B

12345678910111213141516171819
  1. import pathlib
  2. current = pathlib.Path(__file__).parent
  3. root = current.parent
  4. package = root / pathlib.Path("source")
  5. import sys
  6. sys.path.append(str(package))
  7. import cx_libtranslate
  8. sample = cx_libtranslate.translation("This is #{ sample } with #{ number } but this #{ not_exists } and that is #{ bad } type of } } #{ format }} what is it. Number: #{ number }.")
  9. print("Testing...")
  10. print("Result: " + str(sample))
  11. print("Formated: " + sample.format({
  12. "sample": "example",
  13. "number": 10
  14. }) )