Class: Fastlane::Actions::PoesieAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::PoesieAction
- Defined in:
- lib/fastlane/plugin/poesie/actions/poesie_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 37 def self. ["Patrik Potoček"] end |
.available_options ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 41 def self. [ FastlaneCore::ConfigItem.new(key: :api_token, env_name: "POEDITOR_API_TOKEN", description: "The API token for a POEditor.com Account", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :project_id, env_name: "POEDITOR_PROJECT_ID", description: "The ID of the POEditor.com Project", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :languages, env_name: "POEDITOR_SUPPORTED_LANGUAGES", description: "The languages to export", optional: false, type: Array), FastlaneCore::ConfigItem.new(key: :string_files_path, env_name: "PROJECT_STRING_FILES_PATH", description: "The path to localized string files", optional: false, type: String) ] end |
.description ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 33 def self.description "Exports translations from POEditor using poesie tool." end |
.is_supported?(platform) ⇒ Boolean
66 67 68 69 70 71 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 66 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # [:ios, :mac].include?(platform) 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/poesie/actions/poesie_action.rb', line 7 def self.run(params) exporter = ::Poesie::Exporter.new(params[:api_token], params[:project_id]) params[:languages].each do |language| ::Poesie::Log::title("== Language #{language} ==") string_path = params[:string_files_path] + language + ".lproj/Localizable.strings" exporter.run(language) do |terms| # Localizable.strings ::Poesie::AppleFormatter::write_strings_file( terms, string_path, substitutions: nil, print_date: nil ) # Localizable.stringsdict strings_dict_path = string_path.gsub(/\.strings$/,'.stringsdict') ::Poesie::AppleFormatter::write_stringsdict_file( terms, strings_dict_path, substitutions: nil, print_date: nil ) end end end |