Skip to content

Commit

Permalink
fix: fixup previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarIthawi committed Aug 7, 2024
1 parent 33360ba commit ccbdaf2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
8 changes: 3 additions & 5 deletions OpenEdX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
0293A2082A6FCDE50090A336 /* DashboardPersistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardPersistence.swift; sourceTree = "<group>"; };
0298DF2F2A4EF7230023A257 /* AnalyticsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsManager.swift; sourceTree = "<group>"; };
02B6B3C428E1E61400232911 /* CourseDetails.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CourseDetails.framework; sourceTree = BUILT_PRODUCTS_DIR; };
02ED50CA29A64AAA008341CD /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
02ED50D529A6554E008341CD /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = uk; path = "uk.lproj/сountries.json"; sourceTree = "<group>"; };
02ED50D729A65554008341CD /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = Base; path = "Base.lproj/сountries.json"; sourceTree = "<group>"; };
02ED50D929A66007008341CD /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = Base; path = Base.lproj/languages.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -675,7 +674,6 @@
isa = PBXVariantGroup;
children = (
0770DE6528D0BCC7006D8A5D /* en */,
02ED50CA29A64AAA008341CD /* uk */,
);
name = Localizable.strings;
sourceTree = "<group>";
Expand Down Expand Up @@ -1281,8 +1279,8 @@
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 10.26.0;
};
};
};
};
14D912D12C25483F0077CCCE /* XCRemoteSwiftPackageReference "fullstory-swift-package-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/fullstorydev/fullstory-swift-package-ios";
Expand Down Expand Up @@ -1335,7 +1333,7 @@
isa = XCSwiftPackageProductDependency;
package = 0780ABE12BFBA2E40093A4A6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseMessaging;
};
};
14D912D22C25483F0077CCCE /* FullStory */ = {
isa = XCSwiftPackageProductDependency;
package = 14D912D12C25483F0077CCCE /* XCRemoteSwiftPackageReference "fullstory-swift-package-ios" */;
Expand Down
7 changes: 0 additions & 7 deletions OpenEdX/uk.lproj/Localizable.strings

This file was deleted.

17 changes: 11 additions & 6 deletions i18n_scripts/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ def get_xcode_projects(modules_dir: Path) -> [{Path, XcodeProject}]:
Return a list of module_name, xcode_project pairs.
"""
for module_name in get_modules_to_translate(str(modules_dir)):
print(f'## Entering project: {module_name}')
xcode_project = get_xcode_project(modules_dir, module_name)
yield module_name, xcode_project

Expand Down Expand Up @@ -393,6 +392,7 @@ def add_translation_files_to_xcode(modules_dir: Path = None):
modules_dir = get_modules_dir(override=modules_dir)

for module_name, xcode_project in get_xcode_projects(modules_dir):
print(f'## Entering project: {module_name}')
module_path = modules_dir / module_name
project_files_path = module_path / module_name # e.g. openedx-app-ios/Authorization/Authorization

Expand Down Expand Up @@ -429,16 +429,16 @@ def remove_xcode_localizable_variants(xcode_project: XcodeProject) -> None:
xcode_project.remove_files_by_path(file_ref.path, tree=LOCALIZABLE_FILES_TREE, target_name=language)


def delete_translation_files(module_path: Path, module_name: str):
def delete_translation_files(module_path: Path, xcode_project_path_base: Path):
"""
Delete the files from the file system.
:param module_path: Path
:param module_name: str
:param xcode_project_path_base: Path
:return:
"""
for localizable_abs_path in list_translation_files(module_path):
localizable_relative_path = localizable_abs_path.relative_to(module_path / module_name)
localizable_relative_path = localizable_abs_path.relative_to(xcode_project_path_base)
print(f' - Removing "{localizable_relative_path}" file from file system')
localizable_abs_path.unlink()

Expand All @@ -451,15 +451,20 @@ def clean_translation_files(modules_dir: Path = None):
modules_dir = get_modules_dir(override=modules_dir)

for module_name, xcode_project in get_xcode_projects(modules_dir):
print(f'## Entering project: {module_name}')
module_path = modules_dir / module_name
delete_translation_files(module_path, module_name)
delete_translation_files(module_path, xcode_project_path_base=module_path/module_name)
remove_xcode_localizable_variants(xcode_project)
xcode_project.save()

# This project is used to specify which languages are supported by the app for iOS
print(f'## Entering project: {MAIN_MODULE_NAME}')
main_xcode_project = get_xcode_project(modules_dir, module_name=MAIN_MODULE_NAME)
delete_translation_files(modules_dir / MAIN_MODULE_NAME, MAIN_MODULE_NAME)
main_xcode_project_module_path = modules_dir / MAIN_MODULE_NAME
# The main project structure is located into `OpenEdX` rather than `OpenEdX/OpenEdX`
delete_translation_files(main_xcode_project_module_path, main_xcode_project_module_path)
remove_xcode_localizable_variants(main_xcode_project)
main_xcode_project.save()
except Exception as e:
print(f"Error: An unexpected error occurred in clean_translation_files: {e}", file=sys.stderr)
raise
Expand Down

0 comments on commit ccbdaf2

Please sign in to comment.