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

.authors ⇒ Object



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

def self.authors
  ['Alessio Arsuffi']
end

.available_options ⇒ Object



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
# 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: 'Default/fallback language code for the project',
      optional: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :language_map,
      description: '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: '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
    )
  ]
end

.description ⇒ Object



31
32
33
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 31

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

.details ⇒ Object



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

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

.is_supported?(_platform) ⇒ Boolean

Returns:

  • (Boolean)


120
121
122
# File 'lib/fastlane/plugin/ovo_poeditor/actions/ovo_poeditor_strings_action.rb', line 120

def self.is_supported?(_platform)
  true
end

.return_value ⇒ Object



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

def self.return_value
  # If your method provides a return value, you can describe here what it does
  '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
# 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]

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