Class: Fastlane::Actions::OvoPoeditorStringsAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



39
40
41
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 39

def self.authors
  ['Alessio Arsuffi', 'Christian Borsato']
end

.available_optionsObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 51

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :api_token,
      env_name: 'POEDITOR_API_TOKEN',
      description: 'POEditor API token (read-only recommended)',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :project_id,
      env_name: 'POEDITOR_PROJECT_ID',
      description: 'POEditor project ID',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :languages,
      env_name: 'POEDITOR_LANGUAGES',
      description: 'List of language codes to export (e.g. ["en", "it"])',
      optional: false,
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_dir,
      env_name: 'POEDITOR_OUTPUT_DIR',
      description: 'Output directory where the localized files will be written',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :file_name,
      env_name: 'POEDITOR_FILE_NAME',
      description: 'Output file name to write (e.g. Localizable.strings, strings.xml)',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :file_format,
      env_name: 'POEDITOR_EXPORT_FILE_FORMAT',
      description: 'Export file format: xcstrings, apple_strings, android_strings',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :default_language,
      env_name: 'POEDITOR_DEFAULT_LANGUAGE',
      description: 'Optional. Default/fallback language code for the project',
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :language_map,
      description: 'Optional. Map POEditor language codes to platform-specific folder names',
      optional: true,
      type: Hash
    ),
    FastlaneCore::ConfigItem.new(
      key: :unquoted_strings,
      env_name: 'POEDITOR_UNQUOTED_STRINGS',
      description: 'Optional. Set to 1 to export Android strings without quotes (unquoted). Allowed values: 0 or 1',
      optional: true,
      type: Integer,
      default_value: 0,
      verify_block: proc do |value|
        UI.user_error!("unquoted_strings (POEDITOR_UNQUOTED_STRINGS) must be 0 or 1. Received: #{value}.") unless [0, 1].include?(value)
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :bypass_default_language,
      env_name: 'POEDITOR_BYPASS_DEFAULT_LANGUAGE',
      description: 'Optional. Skip the default language check when the output path is built',
      optional: true,
      type: Boolean,
      default_value: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :fallback_languages,
      env_name: 'POEDITOR_FALLBACK_LANGUAGES',
      description: 'Optional. Map of fallback languages',
      optional: true,
      type: Hash
    )
  ]
end

.descriptionObject



35
36
37
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 35

def self.description
  'Fetch latest POEditor terms and download them as .strings/.xml/.xcstrings file'
end

.detailsObject



47
48
49
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 47

def self.details
  'Fetch latest POEditor terms and download them as .strings/.xml/.xcstrings file'
end

.is_supported?(_platform) ⇒ Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 137

def self.is_supported?(_platform)
  true
end

.return_valueObject



43
44
45
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 43

def self.return_value
  'Return a file with all POEditor terms'
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 7

def self.run(params)
  api_token = params[:api_token]
  project_id = params[:project_id]
  languages = params[:languages]
  output_dir = params[:output_dir]
  file_format = params[:file_format]
  file_name = params[:file_name]
  default_language = params[:default_language]
  language_map = params[:language_map]
  unquoted_strings = params[:unquoted_strings]
  bypass_default_language = params[:bypass_default_language]
  fallback_languages = params[:fallback_languages]

  Helper::OvoPoeditorHelper.sync_strings(
    api_token: api_token,
    project_id: project_id,
    languages: languages,
    output_dir: output_dir,
    file_format: file_format,
    file_name: file_name,
    default_language: default_language,
    language_map: language_map,
    unquoted_strings: unquoted_strings,
    bypass_default_language: bypass_default_language,
    fallback_languages: fallback_languages
  )
end