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
48 49 50 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 48 def self. ["Patrik Potoček", "Adam Bezák"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 52 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: true, type: Array), FastlaneCore::ConfigItem.new(key: :strings_file_name, env_name: "PROJECT_STRING_FILE_NAME", description: "Name of a localized .strings file. Default is Localizable.strings", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :strings_path, env_name: "PROJECT_STRING_PATH", description: "Path to a directory where poesie will search for .string files", optional: true, type: String) ] end |
.description ⇒ Object
44 45 46 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 44 def self.description "Exports translations from POEditor using poesie tool." end |
.is_supported?(platform) ⇒ Boolean
82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 82 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
6 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 34 35 36 37 38 39 40 41 42 |
# File 'lib/fastlane/plugin/poesie/actions/poesie_action.rb', line 6 def self.run(params) exporter = ::Poesie::Exporter.new(params[:api_token], params[:project_id]) languages = params[:languages] if languages.nil? languages = Helper::PoesieHelper.list_of_languages(params[:api_token], params[:project_id]) end paths = Helper::PoesieHelper.path_for_localized_file(languages, params[:strings_file_name], params[:strings_path]) if paths.count != languages.count ::Poesie.exit_with_error("Error while finding localized files.\nSearching for languages: #{languages}\nFound: #{paths.keys }}") end languages.each do |language| ::Poesie::Log::title("== Language #{language} ==") string_path = paths[language] 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 |