mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-04 04:23:58 -06:00
Also discover Uranium translation directory
Contributes to issue CURA-6663.
This commit is contained in:
parent
d1c4b63971
commit
5a03ace239
1 changed files with 18 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import argparse #To get the source directory from command line arguments.
|
import argparse #To get the source directory from command line arguments.
|
||||||
|
import os #To find files from the source.
|
||||||
import os.path #To find files from the source and the destination path.
|
import os.path #To find files from the source and the destination path.
|
||||||
|
|
||||||
## Imports translation files from Lionbridge.
|
## Imports translation files from Lionbridge.
|
||||||
|
@ -13,12 +14,26 @@ import os.path #To find files from the source and the destination path.
|
||||||
# preserved.
|
# preserved.
|
||||||
def lionbridge_import(source: str) -> None:
|
def lionbridge_import(source: str) -> None:
|
||||||
print("Importing from:", source)
|
print("Importing from:", source)
|
||||||
print("Importing to:", destination())
|
print("Importing to Cura:", destination_cura())
|
||||||
|
print("Importing to Uranium:", destination_uranium())
|
||||||
|
|
||||||
## Gets the destination path to copy the translations to.
|
## Gets the destination path to copy the translations for Cura to.
|
||||||
def destination() -> str:
|
def destination_cura() -> str:
|
||||||
return os.path.abspath(os.path.join(__file__, "..", "..", "resources", "i18n"))
|
return os.path.abspath(os.path.join(__file__, "..", "..", "resources", "i18n"))
|
||||||
|
|
||||||
|
## Gets the destination path to copy the translations for Uranium to.
|
||||||
|
def destination_uranium() -> str:
|
||||||
|
try:
|
||||||
|
import UM
|
||||||
|
except ImportError:
|
||||||
|
relative_path = os.path.join(__file__, "..", "..", "..", "Uranium", "resources", "i18n", "uranium.pot")
|
||||||
|
print(os.path.abspath(relative_path))
|
||||||
|
if os.path.exists(relative_path):
|
||||||
|
return os.path.abspath(relative_path)
|
||||||
|
else:
|
||||||
|
raise Exception("Can't find Uranium. Please put UM on the PYTHONPATH or put the Uranium folder next to the Cura folder.")
|
||||||
|
return os.path.abspath(os.path.join(UM.__file__, "..", "..", "resources", "i18n"))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
argparser = argparse.ArgumentParser(description = "Import translation files from Lionbridge.")
|
argparser = argparse.ArgumentParser(description = "Import translation files from Lionbridge.")
|
||||||
argparser.add_argument("source")
|
argparser.add_argument("source")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue