Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix FXIOS-10933 String import failing to import new strings #23879

Merged
merged 14 commits into from
Dec 20, 2024
2 changes: 1 addition & 1 deletion .github/workflows/firefox-ios-import-strings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
fi

- name: Run script to import strings
run: sh ./bootstrap.sh --importLocales
run: sh ./firefox-ios/import-strings.sh

- name: Update new strings
run: |-
Expand Down
26 changes: 0 additions & 26 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#
# Use the --force option to force a re-build locales.
# Use the --importLocales option to fetch and update locales only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just another comment @FilippoZazzeroni since you cleaned this bootstrap, is there anything in the wiki that needs to be updated? Just want to double check for instructions in readme, wiki etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check it @nbhasin2, i'll be looking into it tomorrow morning first thing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find anything related to bootstrap --importLocales on the wiki. i modified the link to Strings.swift that was outdated under LocalizationTools and modify Strings.


getLocale() {
echo "Getting locale..."
rm -rf LocalizationTools
git clone https://github.com/mozilla-mobile/LocalizationTools.git || exit 1

echo "Creating firefoxios-l10n Git repo"
rm -rf firefoxios-l10n
git clone --depth 1 https://github.com/mozilla-l10n/firefoxios-l10n firefoxios-l10n || exit 1
}

if [ "$1" == "--force" ]; then
rm -rf firefoxios-l10n
rm -rf LocalizationTools
rm -rf build
fi

if [ "$1" == "--importLocales" ]; then
# Import locales
if [ -d "/firefoxios-l10n" ] && [ -d "/LocalizationTools" ]; then
echo "l10n directories found. Not downloading scripts."
else
echo "l10n directory not found. Downloading repo and scripts."
getLocale
fi

./firefox-ios/import-strings.sh
exit 0
fi

# Download the nimbus-fml.sh script from application-services.
NIMBUS_FML_FILE=./firefox-ios/nimbus.fml.yaml
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/mozilla/application-services/main/components/nimbus/ios/scripts/bootstrap.sh | bash -s -- --directory ./firefox-ios/bin $NIMBUS_FML_FILE
Expand Down
7 changes: 4 additions & 3 deletions firefox-ios/Shared/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
// swiftlint:disable line_length
import Foundation

// MARK: - Localization bundle setup
class BundleClass {}

public struct Strings {
// This is a little workaround to get localizations
// FXIOS-10838 will fix this by moving localizations or this struct into the appropriate place
public static let bundle = Bundle(identifier: "org.mozilla.ios.Localizations") ?? .main
public static let bundle = Bundle(for: BundleClass.self)
}

// MARK: - Localization helper function
Expand Down
17 changes: 17 additions & 0 deletions firefox-ios/import-strings.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@

echo "\n\n[*] Cloning required repo to import strings"

if [ -d "LocalizationTools" ] || [ -d "firefoxios-l10n" ]; then
rm -rf LocalizationTools
rm -rf firefoxios-l10n
fi

git clone https://github.com/mozilla-mobile/LocalizationTools.git || exit 1
git clone --depth 1 https://github.com/mozilla-l10n/firefoxios-l10n || exit 1

pip install -r firefoxios-l10n/.github/scripts/requirements.txt
python3 firefoxios-l10n/.github/scripts/rewrite_original_attribute.py --path firefoxios-l10n

echo "\n\n[*] Building tools/Localizations"
(cd LocalizationTools && swift build)

Expand All @@ -9,3 +22,7 @@ echo "\n\n[*] Importing Strings - takes a minute. (output in import-strings.log)
--l10n-project-path "$PWD/../firefoxios-l10n") > import-strings.log 2>&1

echo "\n\n[!] Strings have been imported. You can now create a PR."

echo "\n\n[*] Clean up cloned repos"
rm -rf LocalizationTools
rm -rf firefoxios-l10n