[Tooling] Migrate ShareExtension to use strings from app bundle - #17636
Merged
Conversation
In all files which are under WordPress/ShareExtension/**
This time for any other files that were not under WordPress/WordPressShareExtension/** (but in WordPress/Classes/** instead)… but were still built as part of the ShareExtension target
As with the changes, some files built as part of the ShareExtension and now using AppLocalizedString() are apparently also part of the DraftAction target too
|
You can trigger an installable build for these changes by visiting CircleCI here. |
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
mokagio
reviewed
Dec 8, 2021
mokagio
left a comment
Contributor
There was a problem hiding this comment.
Code looks good. 👍 Will report later after manual testing.
mokagio
added a commit
that referenced
this pull request
Dec 9, 2021
Got a bunch of conflicts because of deleted files on `develop` that this branch modified, most were localizations because of #17630 and #17636. There was also a conflict on the change in the timeout duration of a test, which I solved by keeping the longest timeout value. I ensured the app built and the tests passed before committing 👌 Full list of conflicting files: - `WordPress/Classes/ViewRelated/Me/App Settings/About/AboutHeaderView.swift` - `WordPress/Classes/ViewRelated/Me/App Settings/About/AutomatticAboutScreen.swift` - `WordPress/Classes/ViewRelated/Me/App Settings/About/AutomatticAppLogosCell.swift` - `WordPress/WordPressShareExtension/ar.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/bg.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/cs.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/cy.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/da.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/de.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/en-AU.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/en-CA.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/en-GB.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/es.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/fr.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/he.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/hr.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/hu.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/id.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/is.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/it.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/ja.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/ko.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/nb.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/nl.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/pl.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/pt-BR.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/pt.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/ro.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/ru.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/sk.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/sq.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/sv.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/th.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/tr.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/zh-Hans.lproj/Localizable.strings` - `WordPress/WordPressShareExtension/zh-Hant.lproj/Localizable.strings` - `WordPress/WordPressTest/LikeUserHelperTests.swift` - `WordPress/WordPressTodayWidget/ar.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/bg.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/cs.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/cy.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/da.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/de.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/en-AU.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/en-CA.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/en-GB.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/es.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/fr.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/he.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/hr.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/hu.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/id.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/is.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/it.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/ja.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/ko.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/nb.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/nl.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/pl.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/pt-BR.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/pt.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/ro.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/ru.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/sk.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/sq.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/sv.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/th.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/tr.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/zh-Hans.lproj/Localizable.strings` - `WordPress/WordPressTodayWidget/zh-Hant.lproj/Localizable.strings`
AliSoftware
added a commit
that referenced
this pull request
Dec 17, 2021
…ng is still WIP We are currently working on removing `update-translations.rb` + `fix-translations` + `extract-framework-translations.swift` scripts from the repo and migrating their logic into the release-toolkit, but that work is still in progress. The role of the (misleadingly named) `extract-frameworks-translations.swift` script was to redistribute the keys from the `*.lproj/Localizable.strings` downloaded from GlotPress into the `.strings` files of the Widgets and ShareExtension targets, back when those targets used their own `.strings` file. This is no longer the case since #17630 and #17636 landed – as Widgets and ShareExtension's code now reference the app's `.strings` file directly – which means we don't need to run the logic from `extract-frameworks-translations.swift` anymore, and in fact if we did, it would probably crash now that the `Base.lproj/Localizable.strings` files in the Widgets and ShareExtension subfolders (which that script references) don't exist anymore.
mokagio
added a commit
that referenced
this pull request
Jan 10, 2022
Conflicts in all the `*.lproj/Localizable.strings` from the WordPressShareExtension and WordPressTodayWidget targets. The conflicts are a byproduct of the work done in #17630 and #17636. I haven't spent the time to research why Git saw those a modified on `trunk` because, regardless, the right thing for them is to be deleted now that the extensions fetch their strings from the main bundle. Also got a conflict on the `ar-SA` release notes. I resolved it by keeping the more recent version from 19.0. Full list of conflicting files: ``` WordPress/WordPressShareExtension/ar.lproj/Localizable.strings WordPress/WordPressShareExtension/bg.lproj/Localizable.strings WordPress/WordPressShareExtension/cs.lproj/Localizable.strings WordPress/WordPressShareExtension/cy.lproj/Localizable.strings WordPress/WordPressShareExtension/da.lproj/Localizable.strings WordPress/WordPressShareExtension/de.lproj/Localizable.strings WordPress/WordPressShareExtension/en-AU.lproj/Localizable.strings WordPress/WordPressShareExtension/en-CA.lproj/Localizable.strings WordPress/WordPressShareExtension/en-GB.lproj/Localizable.strings WordPress/WordPressShareExtension/es.lproj/Localizable.strings WordPress/WordPressShareExtension/fr.lproj/Localizable.strings WordPress/WordPressShareExtension/he.lproj/Localizable.strings WordPress/WordPressShareExtension/hr.lproj/Localizable.strings WordPress/WordPressShareExtension/hu.lproj/Localizable.strings WordPress/WordPressShareExtension/id.lproj/Localizable.strings WordPress/WordPressShareExtension/is.lproj/Localizable.strings WordPress/WordPressShareExtension/it.lproj/Localizable.strings WordPress/WordPressShareExtension/ja.lproj/Localizable.strings WordPress/WordPressShareExtension/ko.lproj/Localizable.strings WordPress/WordPressShareExtension/nb.lproj/Localizable.strings WordPress/WordPressShareExtension/nl.lproj/Localizable.strings WordPress/WordPressShareExtension/pl.lproj/Localizable.strings WordPress/WordPressShareExtension/pt-BR.lproj/Localizable.strings WordPress/WordPressShareExtension/pt.lproj/Localizable.strings WordPress/WordPressShareExtension/ro.lproj/Localizable.strings WordPress/WordPressShareExtension/ru.lproj/Localizable.strings WordPress/WordPressShareExtension/sk.lproj/Localizable.strings WordPress/WordPressShareExtension/sq.lproj/Localizable.strings WordPress/WordPressShareExtension/sv.lproj/Localizable.strings WordPress/WordPressShareExtension/th.lproj/Localizable.strings WordPress/WordPressShareExtension/tr.lproj/Localizable.strings WordPress/WordPressShareExtension/zh-Hans.lproj/Localizable.strings WordPress/WordPressShareExtension/zh-Hant.lproj/Localizable.strings WordPress/WordPressTodayWidget/ar.lproj/Localizable.strings WordPress/WordPressTodayWidget/bg.lproj/Localizable.strings WordPress/WordPressTodayWidget/cs.lproj/Localizable.strings WordPress/WordPressTodayWidget/cy.lproj/Localizable.strings WordPress/WordPressTodayWidget/da.lproj/Localizable.strings WordPress/WordPressTodayWidget/de.lproj/Localizable.strings WordPress/WordPressTodayWidget/en-AU.lproj/Localizable.strings WordPress/WordPressTodayWidget/en-CA.lproj/Localizable.strings WordPress/WordPressTodayWidget/en-GB.lproj/Localizable.strings WordPress/WordPressTodayWidget/es.lproj/Localizable.strings WordPress/WordPressTodayWidget/fr.lproj/Localizable.strings WordPress/WordPressTodayWidget/he.lproj/Localizable.strings WordPress/WordPressTodayWidget/hr.lproj/Localizable.strings WordPress/WordPressTodayWidget/hu.lproj/Localizable.strings WordPress/WordPressTodayWidget/id.lproj/Localizable.strings WordPress/WordPressTodayWidget/is.lproj/Localizable.strings WordPress/WordPressTodayWidget/it.lproj/Localizable.strings WordPress/WordPressTodayWidget/ja.lproj/Localizable.strings WordPress/WordPressTodayWidget/ko.lproj/Localizable.strings WordPress/WordPressTodayWidget/nb.lproj/Localizable.strings WordPress/WordPressTodayWidget/nl.lproj/Localizable.strings WordPress/WordPressTodayWidget/pl.lproj/Localizable.strings WordPress/WordPressTodayWidget/pt-BR.lproj/Localizable.strings WordPress/WordPressTodayWidget/pt.lproj/Localizable.strings WordPress/WordPressTodayWidget/ro.lproj/Localizable.strings WordPress/WordPressTodayWidget/ru.lproj/Localizable.strings WordPress/WordPressTodayWidget/sk.lproj/Localizable.strings WordPress/WordPressTodayWidget/sq.lproj/Localizable.strings WordPress/WordPressTodayWidget/sv.lproj/Localizable.strings WordPress/WordPressTodayWidget/th.lproj/Localizable.strings WordPress/WordPressTodayWidget/tr.lproj/Localizable.strings WordPress/WordPressTodayWidget/zh-Hans.lproj/Localizable.strings WordPress/WordPressTodayWidget/zh-Hant.lproj/Localizable.strings fastlane/metadata/ar-SA/release_notes.txt ```
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


📝 This is part of project ref paaHJt-2Ib-p2 & paaHJt-2J8-p2
➕ This builds on top of #17630 and the
tooling/l10n-step2/ios13-widgetsbranch.What's in this PR
Same stuff as what I did with the iOS14-style Widget and the 3 iOS13-style widgets in previous PRs:
AppLocalizedStrings.swiftto theWordPressShareExtensiontarget. Also had to add it to theWordPressDraftActionExtensiontarget, because files which I migrated toAppLocalizedStringin step 2 happen to also be part of that target too, so I needed it to make that target continue to compile tooNSLocalizedStringin any of the files that are part of thatWordPressShareExtension's "Compile Sources" build phase, to useAppLocalizedStringinstead, so that it looks up the strings in the app bundle(†)*.lproj/Localizable.stringsfiles that were in theWordPressShareExtensiontarget so fare were also present in the correspondingWordPress/Resources/*.lproj/Localizable.strings, with the same value, to ensure it was safe to delete themWordPress/WordPressShareExtension/*.lproj/Localizable.stringsfiles from the disk and theShareExtensiontarget in XcodeNote: Scripts I used to help me with steps 2 & 3
(†) Script to check that the keys in .strings files matched
This script iterated over each
*.lproj/Localizable.stringsof the ShareExtension target, and for each checks that all the keys and values present in that file were also present and with the same translation in the corresponding.stringsfile from the app bundle.(‡) Script to find all occurrences of NSLocalizedString used in a target
This is a script I've also already used in my previous PRs, and lists all the files that are part of the "Compile Sources" build phase of the given target(s), so that I could pipe it with
xargs -0 ag 'NSLocalizedString'to find all files used by theShareExtensionwhere this method/macro was used, and replace those withAppLocalizedStringinsterad.To Test
WordPressShareExtensionscheme in Xcode.stringsfiles in the target's build cacheDemo
Xcode asking you which host app to launch to test the Share Extension with:
Demo of testing the extension in French via Xcode.
ShareExtension-Demo-FR.mp4
Regression Notes
Translation of Share Extension in various locale.
Tested various flows of the Share Extension in simulator, with 2 locales
None
PR submission checklist:
RELEASE-NOTES.txtif necessary.