-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48e1220
commit 0ae27c8
Showing
13 changed files
with
219 additions
and
43 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
4 changes: 4 additions & 0 deletions
4
i18nilize/tests/resources/diffing_algorithm/basic_initial_translations/french.json
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,4 @@ | ||
{ | ||
"hello": "bonjour", | ||
"thanks": "merci" | ||
} |
5 changes: 5 additions & 0 deletions
5
i18nilize/tests/resources/diffing_algorithm/basic_initial_translations/italian.json
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,5 @@ | ||
{ | ||
"hello": "bonjourno", | ||
"thanks": "grazie", | ||
"welcome": "benvenuto" | ||
} |
3 changes: 1 addition & 2 deletions
3
.../resources/test_translations/spanish.json → ...m/basic_initial_translations/spanish.json
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"language": "Spanish", | ||
"hello": "hola", | ||
"thanks": "gracias" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
i18nilize/tests/resources/diffing_algorithm/basic_modified_translations/italian.json
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,4 @@ | ||
{ | ||
"hello": "bonjourno", | ||
"thanks": "La ringrazio" | ||
} |
5 changes: 2 additions & 3 deletions
5
...ources/modified_translations/spanish.json → .../basic_modified_translations/spanish.json
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"language": "Spanish", | ||
"hello": "hola", | ||
"hello": "holi", | ||
"thanks": "gracias", | ||
"welcome": "bienvenido" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
i18nilize/tests/resources/diffing_algorithm/test_translations/french.json
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,4 @@ | ||
{ | ||
"hello": "bonjour", | ||
"thanks": "merci" | ||
} |
5 changes: 5 additions & 0 deletions
5
i18nilize/tests/resources/diffing_algorithm/test_translations/italian.json
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,5 @@ | ||
{ | ||
"hello": "bonjourno", | ||
"thanks": "grazie", | ||
"welcome": "benvenuto" | ||
} |
4 changes: 4 additions & 0 deletions
4
i18nilize/tests/resources/diffing_algorithm/test_translations/spanish.json
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,4 @@ | ||
{ | ||
"hello": "hola", | ||
"thanks": "gracias" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
import json | ||
import os | ||
import shutil | ||
from src.internationalize.diffing_processor import read_language | ||
|
||
class DiffingTestUtil(): | ||
def __init__(self, test_directory): | ||
self.test_directory = test_directory | ||
|
||
""" | ||
Initialize test data for diffing algorithm | ||
""" | ||
def initialize_test_data(self, directory): | ||
self.clear_test_data() | ||
os.mkdir(self.test_directory) | ||
|
||
# this will create all the language files | ||
self.bulk_modify_test_data(directory) | ||
|
||
|
||
""" | ||
Modify test data with new language files | ||
Doesn't support removing a language | ||
""" | ||
def bulk_modify_test_data(self, directory): | ||
file_names = os.listdir(directory) | ||
for file_name in file_names: | ||
language_data = read_language(directory + file_name) | ||
with open(self.test_directory + file_name, 'w') as json_file: | ||
json.dump(language_data, json_file, indent=4) | ||
|
||
""" | ||
Modifies a translation based on the given language, word, and translation | ||
Might already be implemented in PIP package | ||
""" | ||
def modify_test_data(self, language, word, translation): | ||
pass | ||
|
||
def clear_test_data(self): | ||
if os.path.exists(self.test_directory): | ||
shutil.rmtree(self.test_directory) |