Skip to content

Commit db64150

Browse files
committed
Allow en-US metadata to differ from default ones when intentional
1 parent 614e1f0 commit db64150

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

fastlane/Fastfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ GLOTPRESS_APP_STRINGS_PROJECT_URL = 'https://translate.wordpress.com/projects/wo
9090
# URL of the GlotPress project containing App Store Connect metadata
9191
GLOTPRESS_APP_STORE_METADATA_PROJECT_URL = 'https://translate.wordpress.com/projects/woocommerce/woocommerce-ios/release-notes/'
9292

93+
# Set this to `true` if it's intentional that `fastlane/metadata/en-US/` has some `.txt` files overriding the ones in `fastlane/metadata/default/`
94+
# (i.e. you want the `en-US` metadata copies to be _different_ from the metadata copies used as base and fallback for the translation in other locales)
95+
# Set this to `false` otherwise, so that we prevent the accidental case of forgetting to update the `en-US` metadata copies when updating the `default`
96+
# copies during an ASO update, if it was not the intention for those to differ.
97+
ALLOW_EN_US_METADATA_TO_DIFFER_FROM_DEFAULT_LOCALE = true
9398
# List of locales used for the app strings (GlotPress code => `*.lproj` folder name`)
9499
#
95100
# TODO: Replace with `LocaleHelper` once provided by release toolkit (https://github.com/wordpress-mobile/release-toolkit/pull/296)
@@ -1042,11 +1047,13 @@ platform :ios do
10421047
files_to_commit = [File.join(metadata_directory, '**', '*.txt')]
10431048

10441049
# Ensure that none of the `.txt` files in `en-US` would accidentally override our originals in `default`
1045-
target_files.values.map { |h| h[:desc] }.each do |file|
1046-
en_file_path = File.join(metadata_directory, 'en-US', file)
1047-
if File.exist?(en_file_path)
1048-
UI.user_error!("File `#{en_file_path}` would override the same one in `#{metadata_directory}/default`, but `default/` is the source of truth. " \
1049-
+ "Delete the `#{en_file_path}` file, ensure the `default/` one has the expected original copy, and try again.")
1050+
unless ALLOW_EN_US_METADATA_TO_DIFFER_FROM_DEFAULT_LOCALE
1051+
target_files.values.map { |h| h[:desc] }.each do |file|
1052+
en_file_path = File.join(metadata_directory, 'en-US', file)
1053+
if File.exist?(en_file_path)
1054+
UI.user_error!("File `#{en_file_path}` would override the same one in `#{metadata_directory}/default`, but `default/` is the source of truth. " \
1055+
+ "Delete the `#{en_file_path}` file, ensure the `default/` one has the expected original copy, and try again.")
1056+
end
10501057
end
10511058
end
10521059

0 commit comments

Comments
 (0)