This file contains hidden or 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
def identifier(self) -> str: | |
# Specifies identifier with which it can be used from command line. | |
return "grouping" |
This file contains hidden or 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
def importDescription(self) -> str: | |
# This description provide additional information on how this converter imports files. | |
# Since it will only support exporting, state this here | |
return "This converter does not support importing." | |
def exportDescription(self) -> str: | |
# Gives a user more information of what this converter does when exporting. | |
return "Groupes IntermediateEntry elements from different IntermediateLanguage elements by key." |
This file contains hidden or 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
# Since it won't allow importing a file, raise an error. | |
def toIntermediate(self, filepath: str) -> Optional[IntermediateLocalization]: | |
raise NotImplementedError |
This file contains hidden or 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
def fromIntermediate( | |
self, | |
intermediateLocalization: IntermediateLocalization | |
) -> List[LocalizationFile]: | |
# 1 | |
keyDict: Dict[str, List[Tuple[str, str]]] = {} | |
# 2 | |
for language in intermediateLocalization.intermediateLanguages: |
This file contains hidden or 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
import unittest | |
from ..model.IntermediateEntry import IntermediateEntry | |
from ..model.IntermediateLanguage import IntermediateLanguage | |
from ..model.IntermediateLocalization import IntermediateLocalization | |
from ..model.LocalizationFile import LocalizationFile | |
from ..converter.GroupingConverter import GroupingConverter |
This file contains hidden or 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
def _createMultiLanguageIntermediateLocalization(self) -> IntermediateLocalization: | |
# Create first language, e.g. English | |
enEntry1 = IntermediateEntry("Key1", "Value in English") | |
enEntry2 = IntermediateEntry("Key2", "Another value in English") | |
enLanguage = IntermediateLanguage("en", [enEntry1, enEntry2]) | |
# Create second language, e.g. German | |
deEntry1 = IntermediateEntry("Key1", "Value in German") | |
deEntry2 = IntermediateEntry("Key2", "Another value in German") | |
deLanguage = IntermediateLanguage("de", [deEntry1, deEntry2]) |
This file contains hidden or 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
def testTest(self): | |
expectation = self._createExpectedOutput() | |
intermediate = self._createMultiLanguageIntermediateLocalization() | |
result = self.sut.fromIntermediate(intermediate)[0] | |
self.assertEqual(expectation, result) |
This file contains hidden or 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
# Add new converter to imports. | |
from .converter.GroupingConverter import GroupingConverter |
This file contains hidden or 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
registeredConverter = [ | |
iOSConverter(), | |
iOSEnumConverter(), | |
AndroidConverter(), | |
JSONConverter(), | |
# Add new converter to list of registered converter. | |
GroupingConverter() | |
] |
This file contains hidden or 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
{ | |
"timetable": { | |
"en": { | |
"TIMETABLE_HEADER": "Timetable", | |
"TIMETABLE_NO_CONTENT": "No data available yet", | |
"TIMETABLE_LOADING_CONTENT": "Loading new data ..." | |
}, | |
"de": { | |
"TIMETABLE_HEADER": "Zeitplan", | |
"TIMETABLE_NO_CONTENT": "Noch keine Daten vorhanden", |