Skip to content

Helps to update the translations of your app using the OneSky service and fastlane.

License

Notifications You must be signed in to change notification settings

thekie/fastlane-plugin-onesky

Repository files navigation

OneSky Fastlane Plugin

fastlane Plugin Badge

Getting Started

This project is a fastlane plugin. To get started with fastlane-plugin-onesky, add it to your project by running:

fastlane add_plugin onesky

About

This fastlane plugin helps you to update the translations of your app using the OneSky service. You can upload your current base localization file with onesky_upload and download new translations with onesky_download from OneSky.

OneSky is a translation service for to help ypu translate your iOS, Android, Websites and Software. TO find out more about the OneSky Service, please head over to http://www.oneskyapp.com.

Reference and Example

The OneSky fastlane plugin provides two new actions: onesky_upload and onesky_download

onesky_upload

Uploads a new translation file to the onesky service.

onesky_upload(
      public_key: "abc123abc123abc123abc123abc123abc",
      secret_key: "xyz890xyz890xyz890xyz890xyz890xyz",
      project_id: "1234",
      strings_file_path: "./localizations/en.xliff",
      strings_file_format: "XLIFF",
      deprecate_missing: true
    )
Parameter Description
public_key Your OneSky account public key. You retrive it by logging into your OneSky account, go to Settings and then API Keys & Usages.
private_key Your OneSky account private key. You retrive it by logging into your OneSky account, go to Settings and then API Keys & Usages.
project_id The ID of the project you want the tranlstions uploaded for. You retrive it, by logging into your OneSky account, navigate to your projects overview and copy the number behind the # in the brackets. (i.e. (#1234) -> "1234")
strings_file_path The file path to the localization file you want to upload.
strings_file_format The format of localization file you want to upload. For more information about the available types head over to https://github.com/onesky/api-documentation-platform/blob/master/reference/format.md.
deprecate_missing (optional) Indicates whether the strings that aren't available in the new translation file should be marked as deprecated. Defaults to false.

onesky_download

Uploads a new translation file to the onesky service.

onesky_download(
      public_key: "abc123abc123abc123abc123abc123abc",
      secret_key: "xyz890xyz890xyz890xyz890xyz890xyz",
      project_id: "1234",
      locale: "de",
      filename: "en.xliff",
      destination: "./localizations/de.xliff"
    )
Parameter Description
public_key Your OneSky account public key. You retrive it by logging into your OneSky account, go to Settings and then API Keys & Usages.
private_key Your OneSky account private key. You retrive it by logging into your OneSky account, go to Settings and then API Keys & Usages.
project_id The ID of the project you want the tranlstions downloaded for. You retrive it, by logging into your OneSky account, navigate to your projects overview and copy the number behind the # in the brackets. (i.e. (#1234) -> "1234")
locale The locale your wnat to download the translation for.
filename The filename fo the file you want the translation for. It is the name of your original uploaded file.
destination Filepath of the file to write the translations to.

Run tests for this plugin

To run both the tests, and code style validation, run

rake

To automatically fix many of the styling issues, use

rubocop -a

Goes well with fastlane-plugin-localization

This plugin works really well with the plugin localization by @vmalyi. fastlane-plugin-localization helps you to extract your localization files form your XCode Projects using xcodebuild.

Here are example lanes to use fastlane-plugin-localization and fastlane-plugin-onesky to manage your translations:

desc "Extracts and uploads base localization to OneSky"
  lane :export_translations do 
    export_localizations(
      destination_path: "./localizations",
      project: "YourApp.xcodeproj"
    )
    onesky_upload(
      public_key: "abc123abc123abc123abc123abc123abc",
      secret_key: "xyz890xyz890xyz890xyz890xyz890xyz",
      project_id: "1234",
      strings_file_path: "./localizations/en.xliff",
      strings_file_format: "XLIFF",
      deprecate_missing: true
    )
  end

  desc "Downloads current translations from OneSky and imports into the xcode project"
  lane :download_translations do 
    onesky_download(
      public_key: "abc123abc123abc123abc123abc123abc",
      secret_key: "xyz890xyz890xyz890xyz890xyz890xyz",
      project_id: "1234",
      locale: "de",
      filename: "en.xliff",
      destination: "./localizations/de.xliff"
    )
    import_localizations(
      source_path: "./localizations/de.xliff",
      project: "YourApp.xcodeproj"
    )
  end

Issues and Feedback

For any other issues and feedback about this plugin, please submit it to this repository.

Troubleshooting

If you have trouble using plugins, check out the Plugins Troubleshooting doc in the main fastlane repo.

Using fastlane Plugins

For more information about how the fastlane plugin system works, check out the Plugins documentation.

About fastlane

fastlane is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out fastlane.tools.

Acknowledgements

The code for the upload action is based on the fastlane plugin upload_to_onesky by @joshrlesch: https://github.com/joshrlesch/fastlane-plugin-upload_to_onesky

This plugin was developed for and during the work on the Youpooly iOS App.

About

Helps to update the translations of your app using the OneSky service and fastlane.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages