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



37
38
39
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 37

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

.available_optionsObject



49
50
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
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 49

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
    )
  ]
end

.descriptionObject



33
34
35
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 33

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

.detailsObject



45
46
47
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 45

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

.is_supported?(_platform) ⇒ Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 128

def self.is_supported?(_platform)
  true
end

.return_valueObject



41
42
43
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 41

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
# 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]

  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
  )
end