-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NXDRIVE-2915: Translate Document type and container type labels on Di…
…rect Transfer popup (#5129) * NXDRIVE-2915: Translate Document type and container type labels on Direct Transfer popup
- Loading branch information
1 parent
17e552e
commit 4878e47
Showing
5 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from ..translator import Translator | ||
|
||
|
||
def get_known_types_translations() -> dict: | ||
KNOWN_FOLDER_TYPES = { | ||
"OrderedFolder": Translator.get("ORDERED_FOLDER"), | ||
"Folder": Translator.get("FOLDER"), | ||
} | ||
KNOWN_FILE_TYPES = { | ||
"Audio": Translator.get("AUDIO"), | ||
"File": Translator.get("FILE"), | ||
"Picture": Translator.get("PICTURE"), | ||
"Video": Translator.get("VIDEO"), | ||
} | ||
DEFAULT_TYPES = { | ||
"Automatic": Translator.get("AUTOMATICS"), | ||
"Create": Translator.get("CREATE"), | ||
} | ||
|
||
return { | ||
"FOLDER_TYPES": KNOWN_FOLDER_TYPES, | ||
"FILE_TYPES": KNOWN_FILE_TYPES, | ||
"DEFAULT": DEFAULT_TYPES, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pathlib import Path | ||
|
||
from nxdrive.gui.constants import get_known_types_translations | ||
from nxdrive.translator import Translator | ||
|
||
|
||
def get_folder(folder) -> Path: | ||
return Path(__file__).parent.parent / "resources" / folder | ||
|
||
|
||
def test_get_known_types_translations(): | ||
Translator(get_folder("i18n")) | ||
assert Translator.locale() == "en" | ||
res = get_known_types_translations() | ||
|
||
known_folder_types = res.get("FOLDER_TYPES", {}) | ||
known_file_types = res.get("FILE_TYPES", {}) | ||
default_types = res.get("DEFAULT", {}) | ||
|
||
assert known_folder_types["Folder"] == Translator.get("FOLDER") | ||
assert known_file_types["Audio"] == Translator.get("AUDIO") | ||
assert default_types["Automatic"] == Translator.get("AUTOMATICS") |