fastlane-plugin-wpmreleasetoolkit 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +8 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +8 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +11 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +10 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +90 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb +89 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +2 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +8 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +10 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +10 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +113 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_generate_strings_file_from_code.rb +115 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +5 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +6 -7
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_strings_files.rb +75 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +0 -20
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +8 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +3 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +48 -8
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb +93 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +3 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +108 -173
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +207 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +3 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +1 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +26 -39
- data/bin/drawText +0 -20
- data/ext/drawText/drawText/Assets/style.css +0 -1
- data/ext/drawText/drawText/CoreTextStack.swift +0 -113
- data/ext/drawText/drawText/Helpers/CommandLineHelpers.swift +0 -36
- data/ext/drawText/drawText/Helpers/Extensions.swift +0 -27
- data/ext/drawText/drawText/Helpers/FileSystemHelper.swift +0 -24
- data/ext/drawText/drawText/Stylesheet.swift +0 -48
- data/ext/drawText/drawText/TextImage.swift +0 -100
- data/ext/drawText/drawText/main.swift +0 -61
- data/ext/drawText/drawText Tests/DigitParsingTests.swift +0 -21
- data/ext/drawText/drawText Tests/ExtensionsTests.swift +0 -5
- data/ext/drawText/drawText Tests/Info.plist +0 -22
- data/ext/drawText/drawText Tests/StylesheetTests.swift +0 -31
- data/ext/drawText/drawText Tests/Test Cases/default-stylesheet.txt +0 -10
- data/ext/drawText/drawText Tests/Test Cases/external-styles-sample.css +0 -3
- data/ext/drawText/drawText Tests/Test Cases/external-styles-test.txt +0 -13
- data/ext/drawText/drawText Tests/Test Cases/large-text-block.txt +0 -1
- data/ext/drawText/drawText Tests/Test Cases/regular-text-block.txt +0 -2
- data/ext/drawText/drawText Tests/Test Cases/rtl-text-block.txt +0 -2
- data/ext/drawText/drawText Tests/Test Cases/text-size-adjustment-test.txt +0 -10
- data/ext/drawText/drawText Tests/TextImageTests.swift +0 -99
- data/ext/drawText/drawText Tests/drawText_Tests.swift +0 -14
- data/ext/drawText/drawText.xcodeproj/project.pbxproj +0 -508
- data/ext/drawText/drawText.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/ext/drawText/drawText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText Tests.xcscheme +0 -57
- data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText.xcscheme +0 -109
- data/ext/drawText/extconf.rb +0 -36
- data/ext/drawText/makefile.example +0 -8
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +0 -106
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +0 -52
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +0 -93
@@ -1,57 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<Scheme
|
3
|
-
LastUpgradeVersion = "1030"
|
4
|
-
version = "1.3">
|
5
|
-
<BuildAction
|
6
|
-
parallelizeBuildables = "YES"
|
7
|
-
buildImplicitDependencies = "YES">
|
8
|
-
</BuildAction>
|
9
|
-
<TestAction
|
10
|
-
buildConfiguration = "Debug"
|
11
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
12
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
13
|
-
codeCoverageEnabled = "YES"
|
14
|
-
shouldUseLaunchSchemeArgsEnv = "YES">
|
15
|
-
<Testables>
|
16
|
-
<TestableReference
|
17
|
-
skipped = "NO">
|
18
|
-
<BuildableReference
|
19
|
-
BuildableIdentifier = "primary"
|
20
|
-
BlueprintIdentifier = "F907EA6F22F3736E00196382"
|
21
|
-
BuildableName = "drawText Tests.xctest"
|
22
|
-
BlueprintName = "drawText Tests"
|
23
|
-
ReferencedContainer = "container:drawText.xcodeproj">
|
24
|
-
</BuildableReference>
|
25
|
-
</TestableReference>
|
26
|
-
</Testables>
|
27
|
-
<AdditionalOptions>
|
28
|
-
</AdditionalOptions>
|
29
|
-
</TestAction>
|
30
|
-
<LaunchAction
|
31
|
-
buildConfiguration = "Debug"
|
32
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
33
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
34
|
-
launchStyle = "0"
|
35
|
-
useCustomWorkingDirectory = "NO"
|
36
|
-
ignoresPersistentStateOnLaunch = "NO"
|
37
|
-
debugDocumentVersioning = "YES"
|
38
|
-
debugServiceExtension = "internal"
|
39
|
-
allowLocationSimulation = "YES">
|
40
|
-
<AdditionalOptions>
|
41
|
-
</AdditionalOptions>
|
42
|
-
</LaunchAction>
|
43
|
-
<ProfileAction
|
44
|
-
buildConfiguration = "Release"
|
45
|
-
shouldUseLaunchSchemeArgsEnv = "YES"
|
46
|
-
savedToolIdentifier = ""
|
47
|
-
useCustomWorkingDirectory = "NO"
|
48
|
-
debugDocumentVersioning = "YES">
|
49
|
-
</ProfileAction>
|
50
|
-
<AnalyzeAction
|
51
|
-
buildConfiguration = "Debug">
|
52
|
-
</AnalyzeAction>
|
53
|
-
<ArchiveAction
|
54
|
-
buildConfiguration = "Release"
|
55
|
-
revealArchiveInOrganizer = "YES">
|
56
|
-
</ArchiveAction>
|
57
|
-
</Scheme>
|
@@ -1,109 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<Scheme
|
3
|
-
LastUpgradeVersion = "1030"
|
4
|
-
version = "1.3">
|
5
|
-
<BuildAction
|
6
|
-
parallelizeBuildables = "YES"
|
7
|
-
buildImplicitDependencies = "YES">
|
8
|
-
<BuildActionEntries>
|
9
|
-
<BuildActionEntry
|
10
|
-
buildForTesting = "YES"
|
11
|
-
buildForRunning = "YES"
|
12
|
-
buildForProfiling = "YES"
|
13
|
-
buildForArchiving = "YES"
|
14
|
-
buildForAnalyzing = "YES">
|
15
|
-
<BuildableReference
|
16
|
-
BuildableIdentifier = "primary"
|
17
|
-
BlueprintIdentifier = "F99B0B9722F24329002851D8"
|
18
|
-
BuildableName = "drawText"
|
19
|
-
BlueprintName = "drawText"
|
20
|
-
ReferencedContainer = "container:drawText.xcodeproj">
|
21
|
-
</BuildableReference>
|
22
|
-
</BuildActionEntry>
|
23
|
-
</BuildActionEntries>
|
24
|
-
</BuildAction>
|
25
|
-
<TestAction
|
26
|
-
buildConfiguration = "Debug"
|
27
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
28
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
29
|
-
codeCoverageEnabled = "YES"
|
30
|
-
shouldUseLaunchSchemeArgsEnv = "YES">
|
31
|
-
<Testables>
|
32
|
-
<TestableReference
|
33
|
-
skipped = "NO">
|
34
|
-
<BuildableReference
|
35
|
-
BuildableIdentifier = "primary"
|
36
|
-
BlueprintIdentifier = "F907EA6F22F3736E00196382"
|
37
|
-
BuildableName = "drawText Tests.xctest"
|
38
|
-
BlueprintName = "drawText Tests"
|
39
|
-
ReferencedContainer = "container:drawText.xcodeproj">
|
40
|
-
</BuildableReference>
|
41
|
-
</TestableReference>
|
42
|
-
</Testables>
|
43
|
-
<MacroExpansion>
|
44
|
-
<BuildableReference
|
45
|
-
BuildableIdentifier = "primary"
|
46
|
-
BlueprintIdentifier = "F99B0B9722F24329002851D8"
|
47
|
-
BuildableName = "drawText"
|
48
|
-
BlueprintName = "drawText"
|
49
|
-
ReferencedContainer = "container:drawText.xcodeproj">
|
50
|
-
</BuildableReference>
|
51
|
-
</MacroExpansion>
|
52
|
-
<AdditionalOptions>
|
53
|
-
</AdditionalOptions>
|
54
|
-
</TestAction>
|
55
|
-
<LaunchAction
|
56
|
-
buildConfiguration = "Debug"
|
57
|
-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
58
|
-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
59
|
-
launchStyle = "0"
|
60
|
-
useCustomWorkingDirectory = "NO"
|
61
|
-
ignoresPersistentStateOnLaunch = "NO"
|
62
|
-
debugDocumentVersioning = "YES"
|
63
|
-
debugServiceExtension = "internal"
|
64
|
-
allowLocationSimulation = "YES">
|
65
|
-
<BuildableProductRunnable
|
66
|
-
runnableDebuggingMode = "0">
|
67
|
-
<BuildableReference
|
68
|
-
BuildableIdentifier = "primary"
|
69
|
-
BlueprintIdentifier = "F99B0B9722F24329002851D8"
|
70
|
-
BuildableName = "drawText"
|
71
|
-
BlueprintName = "drawText"
|
72
|
-
ReferencedContainer = "container:drawText.xcodeproj">
|
73
|
-
</BuildableReference>
|
74
|
-
</BuildableProductRunnable>
|
75
|
-
<EnvironmentVariables>
|
76
|
-
<EnvironmentVariable
|
77
|
-
key = "CG_CONTEXT_SHOW_BACKTRACE"
|
78
|
-
value = ""
|
79
|
-
isEnabled = "YES">
|
80
|
-
</EnvironmentVariable>
|
81
|
-
</EnvironmentVariables>
|
82
|
-
<AdditionalOptions>
|
83
|
-
</AdditionalOptions>
|
84
|
-
</LaunchAction>
|
85
|
-
<ProfileAction
|
86
|
-
buildConfiguration = "Release"
|
87
|
-
shouldUseLaunchSchemeArgsEnv = "YES"
|
88
|
-
savedToolIdentifier = ""
|
89
|
-
useCustomWorkingDirectory = "NO"
|
90
|
-
debugDocumentVersioning = "YES">
|
91
|
-
<BuildableProductRunnable
|
92
|
-
runnableDebuggingMode = "0">
|
93
|
-
<BuildableReference
|
94
|
-
BuildableIdentifier = "primary"
|
95
|
-
BlueprintIdentifier = "F99B0B9722F24329002851D8"
|
96
|
-
BuildableName = "drawText"
|
97
|
-
BlueprintName = "drawText"
|
98
|
-
ReferencedContainer = "container:drawText.xcodeproj">
|
99
|
-
</BuildableReference>
|
100
|
-
</BuildableProductRunnable>
|
101
|
-
</ProfileAction>
|
102
|
-
<AnalyzeAction
|
103
|
-
buildConfiguration = "Debug">
|
104
|
-
</AnalyzeAction>
|
105
|
-
<ArchiveAction
|
106
|
-
buildConfiguration = "Release"
|
107
|
-
revealArchiveInOrganizer = "YES">
|
108
|
-
</ArchiveAction>
|
109
|
-
</Scheme>
|
data/ext/drawText/extconf.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'mkmf'
|
3
|
-
require 'os'
|
4
|
-
|
5
|
-
drawTextDirectory = File.dirname(File.absolute_path(__FILE__))
|
6
|
-
compilationDirectory = Dir.pwd
|
7
|
-
libDirectory = File.join(File.dirname(File.dirname(drawTextDirectory)), '/lib')
|
8
|
-
|
9
|
-
# Copy the makefile required for compilation
|
10
|
-
FileUtils.cp(File.join(drawTextDirectory, 'makefile.example'), File.join(compilationDirectory, 'Makefile'))
|
11
|
-
|
12
|
-
# Only compile drawText on macOS
|
13
|
-
exit 0 unless OS.mac?
|
14
|
-
|
15
|
-
# Swift is needed to compile the extension
|
16
|
-
find_executable('swift')
|
17
|
-
find_executable('xcodebuild')
|
18
|
-
|
19
|
-
system(
|
20
|
-
'xcodebuild',
|
21
|
-
'-project', File.join(drawTextDirectory, 'drawText.xcodeproj'),
|
22
|
-
'-scheme', 'drawText',
|
23
|
-
'-derivedDataPath', compilationDirectory,
|
24
|
-
'-configuration', 'RELEASE'
|
25
|
-
)
|
26
|
-
|
27
|
-
compiledPath = File.join(compilationDirectory, 'Build', 'Products', 'Release', 'drawText')
|
28
|
-
destinationPath = File.join(libDirectory, 'drawText')
|
29
|
-
|
30
|
-
# Delete and overwrite the binary
|
31
|
-
FileUtils.rm_rf(destinationPath)
|
32
|
-
FileUtils.cp(compiledPath, destinationPath)
|
33
|
-
|
34
|
-
# Delete and overwrite the bundle file
|
35
|
-
FileUtils.rm_rf(File.join(libDirectory, 'drawText.bundle'))
|
36
|
-
FileUtils.touch(File.join(compilationDirectory, "drawText.#{RbConfig::CONFIG['DLEXT']}"))
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'fastlane/action'
|
2
|
-
require 'date'
|
3
|
-
require_relative '../../helper/github_helper'
|
4
|
-
require_relative '../../helper/ios/ios_version_helper'
|
5
|
-
require_relative '../../helper/android/android_version_helper'
|
6
|
-
module Fastlane
|
7
|
-
module Actions
|
8
|
-
class AndroidMergeTranslatorsStringsAction < Action
|
9
|
-
def self.run(params)
|
10
|
-
folder_path = File.expand_path(params[:strings_folder])
|
11
|
-
|
12
|
-
subfolders = Dir.entries(folder_path)
|
13
|
-
subfolders.each do |strings_folder|
|
14
|
-
merge_folder(File.join(folder_path, strings_folder)) if strings_folder.start_with?('values')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.merge_folder(strings_folder)
|
19
|
-
main_file = File.join(strings_folder, 'strings.xml')
|
20
|
-
return unless File.exist?(main_file)
|
21
|
-
|
22
|
-
UI.message("Merging in: #{strings_folder}")
|
23
|
-
|
24
|
-
tmp_main_file = "#{main_file}.tmp"
|
25
|
-
FileUtils.cp(main_file, tmp_main_file)
|
26
|
-
|
27
|
-
join_files = Dir.glob(File.join(strings_folder, 'strings-*.xml'))
|
28
|
-
extra_strings = []
|
29
|
-
extra_keys = []
|
30
|
-
join_files.each do |join_strings|
|
31
|
-
my_strings = File.read(join_strings).split("\n")
|
32
|
-
my_strings.each do |string|
|
33
|
-
if string.include?('<string name')
|
34
|
-
string_key = string.strip.split('>').first
|
35
|
-
unless extra_keys.include?(string_key)
|
36
|
-
extra_strings << string
|
37
|
-
extra_keys << string_key
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
File.delete(join_strings)
|
43
|
-
end
|
44
|
-
|
45
|
-
File.open(main_file, 'w') do |f|
|
46
|
-
File.open(tmp_main_file).each do |line|
|
47
|
-
f.puts(extra_strings) if line.strip == '</resources>'
|
48
|
-
f.puts(check_line(line, extra_strings))
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
File.delete(tmp_main_file)
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.check_line(line, extra_strings)
|
56
|
-
return line unless line.include?('<string name')
|
57
|
-
|
58
|
-
test_line = line.strip.split('>').first
|
59
|
-
extra_strings.each do |overwrite_string|
|
60
|
-
return '' if overwrite_string.strip.split('>').first == test_line
|
61
|
-
end
|
62
|
-
|
63
|
-
return line
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.description
|
67
|
-
'Merge strings for translators'
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.authors
|
71
|
-
['Lorenzo Mattei']
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.return_value
|
75
|
-
# If your method provides a return value, you can describe here what it does
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.details
|
79
|
-
# Optional:
|
80
|
-
'Merges waiting and fuzzy strings into the main file for translators. This action is deprecated in favor of `android_download_translations`'
|
81
|
-
end
|
82
|
-
|
83
|
-
def self.available_options
|
84
|
-
[
|
85
|
-
FastlaneCore::ConfigItem.new(key: :strings_folder,
|
86
|
-
env_name: 'AMTS_STRING_FOLDER',
|
87
|
-
description: 'The folder that contains all the translations',
|
88
|
-
optional: false,
|
89
|
-
type: String),
|
90
|
-
]
|
91
|
-
end
|
92
|
-
|
93
|
-
def self.is_supported?(platform)
|
94
|
-
true
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.category
|
98
|
-
:deprecated
|
99
|
-
end
|
100
|
-
|
101
|
-
def self.deprecated_notes
|
102
|
-
'This action is deprecated in favor of `android_download_translations` (using an array for the status_filter parameter)'
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module Fastlane
|
2
|
-
module Actions
|
3
|
-
module SharedValues
|
4
|
-
ANDROID_UPDATE_METADATA_CUSTOM_VALUE = :ANDROID_UPDATE_METADATA_CUSTOM_VALUE
|
5
|
-
end
|
6
|
-
|
7
|
-
class AndroidUpdateMetadataAction < Action
|
8
|
-
def self.run(params)
|
9
|
-
require_relative '../../helper/android/android_git_helper'
|
10
|
-
|
11
|
-
Fastlane::Helper::Android::GitHelper.update_metadata(ENV['validate_translations'])
|
12
|
-
end
|
13
|
-
|
14
|
-
#####################################################
|
15
|
-
# @!group Documentation
|
16
|
-
#####################################################
|
17
|
-
|
18
|
-
def self.description
|
19
|
-
'Downloads translated metadata from the translation system'
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.details
|
23
|
-
'Downloads translated metadata from the translation system. This action is deprecated in favor of `android_download_translations`'
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.available_options
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.output
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.return_value
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.authors
|
36
|
-
['loremattei']
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.is_supported?(platform)
|
40
|
-
platform == :android
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.category
|
44
|
-
:deprecated
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.deprecated_notes
|
48
|
-
'This action is deprecated in favor of `android_download_translations`'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
require 'fastlane/action'
|
2
|
-
require 'date'
|
3
|
-
require_relative '../../helper/github_helper'
|
4
|
-
require_relative '../../helper/ios/ios_version_helper'
|
5
|
-
module Fastlane
|
6
|
-
module Actions
|
7
|
-
class IosMergeTranslatorsStringsAction < Action
|
8
|
-
def self.run(params)
|
9
|
-
folder_path = File.expand_path(params[:strings_folder])
|
10
|
-
|
11
|
-
subfolders = Dir.entries(folder_path)
|
12
|
-
subfolders.each do |strings_folder|
|
13
|
-
merge_folder(File.join(folder_path, strings_folder)) if strings_folder.ends_with?('.lproj')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.merge_folder(strings_folder)
|
18
|
-
main_file = File.join(strings_folder, 'Localizable.strings')
|
19
|
-
tmp_main_file = File.join(strings_folder, 'Localizable_current.strings')
|
20
|
-
return unless File.exist?(main_file) && File.exist?(tmp_main_file)
|
21
|
-
|
22
|
-
UI.message("Merging in: #{strings_folder}")
|
23
|
-
|
24
|
-
join_files = Dir.glob(File.join(strings_folder, 'Localizable_*.strings')) - [tmp_main_file]
|
25
|
-
extra_strings = []
|
26
|
-
extra_keys = []
|
27
|
-
join_files.each do |join_strings|
|
28
|
-
my_strings = File.read(join_strings).split("\n")
|
29
|
-
my_strings.each do |string|
|
30
|
-
if string[/^"(.*)" = "(.*)";$/]
|
31
|
-
/^"(?<string_key>.*)" = "/i =~ string
|
32
|
-
unless extra_keys.include?(string_key)
|
33
|
-
extra_strings << string
|
34
|
-
extra_keys << string_key
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
File.delete(join_strings)
|
40
|
-
end
|
41
|
-
|
42
|
-
File.open(main_file, 'w') do |f|
|
43
|
-
File.open(tmp_main_file).each do |line|
|
44
|
-
f.puts(check_line(line, extra_keys))
|
45
|
-
end
|
46
|
-
f.puts(extra_strings)
|
47
|
-
end
|
48
|
-
|
49
|
-
File.delete(tmp_main_file)
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.check_line(line, extra_keys)
|
53
|
-
return line unless line[/^"(.*)" = "(.*)";$/]
|
54
|
-
|
55
|
-
/^"(?<line_key>.*)" = "/i =~ line
|
56
|
-
return '' if extra_keys.include?(line_key)
|
57
|
-
|
58
|
-
return line
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.description
|
62
|
-
'Merge strings for translators'
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.authors
|
66
|
-
['Lorenzo Mattei']
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.return_value
|
70
|
-
# If your method provides a return value, you can describe here what it does
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.details
|
74
|
-
# Optional:
|
75
|
-
'Merges waiting and fuzzy strings into the main file for translators'
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.available_options
|
79
|
-
[
|
80
|
-
FastlaneCore::ConfigItem.new(key: :strings_folder,
|
81
|
-
env_name: 'IMTS_STRING_FOLDER',
|
82
|
-
description: 'The folder that contains all the translations',
|
83
|
-
optional: false,
|
84
|
-
type: String),
|
85
|
-
]
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.is_supported?(platform)
|
89
|
-
true
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|