mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Add documentation
Contributes to issue CURA-6663.
This commit is contained in:
parent
a3611404d6
commit
58c32f97a1
1 changed files with 11 additions and 1 deletions
|
@ -42,10 +42,12 @@ def lionbridge_import(source: str) -> None:
|
|||
print(result) #DEBUG! Instead we should write this to a file.
|
||||
|
||||
## Gets the destination path to copy the translations for Cura to.
|
||||
# \return Destination path for Cura.
|
||||
def destination_cura() -> str:
|
||||
return os.path.abspath(os.path.join(__file__, "..", "..", "resources", "i18n"))
|
||||
|
||||
## Gets the destination path to copy the translations for Uranium to.
|
||||
# \return Destination path for Uranium.
|
||||
def destination_uranium() -> str:
|
||||
try:
|
||||
import UM
|
||||
|
@ -58,6 +60,10 @@ def destination_uranium() -> str:
|
|||
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"))
|
||||
|
||||
## Merges translations from the source file into the destination file if they
|
||||
# were missing in the destination file.
|
||||
# \param source The contents of the source .po file.
|
||||
# \param destination The contents of the destination .po file.
|
||||
def merge(source: str, destination: str) -> str:
|
||||
last_destination = {
|
||||
"msgctxt": "",
|
||||
|
@ -86,7 +92,11 @@ def merge(source: str, destination: str) -> str:
|
|||
if last_destination["msgstr"] == "" and last_destination["msgid"] != "": #No translation for this yet!
|
||||
translation = find_translation(source, last_destination["msgctxt"], last_destination["msgid"])
|
||||
|
||||
def find_translation(source: str, msgctxt, msgid):
|
||||
## Finds a translation in the source file.
|
||||
# \param source The contents of the source .po file.
|
||||
# \param msgctxt The ctxt of the translation to find.
|
||||
# \param msgid The id of the translation to find.
|
||||
def find_translation(source: str, msgctxt: str, msgid: str) -> str:
|
||||
last_source = {
|
||||
"msgctxt": "",
|
||||
"msgid": "",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue