Fastlane csv_translation
plugin
Getting Started
This project is a fastlane plugin. To get started with fastlane-plugin-csv_translation
, add it to your project by running:
fastlane add_plugin csv_translation
If you are using fastlane using Gemfile in your project, add it to your project by running:
bundle exec fastlane add_plugin csv_translation
About csv_translation
A fastlane plugin to manage translation using a CSV file under git repository. π
This plugin is inspired by and based on Keep a CSV under git repository. This CSV file can contains translated details for different locales, which can be defined as CSV headers.
This plugin opens up an opportunity to automate reading from/writing of any CSV
file with fastlane
.
CSV file (Example)
CSV
file must have locale headers, and can have one identifier header. i.e Below CSV supports en-US, nl-NL, de-DE, fr-FR, it, es-ES, pt-PT, da, sv, no, zh-Hans, zh-Hant
and Ticket
column is the unique identifier column which later will be useful to a delete CSV row
Actions
fastlane-plugin-csv_translation
consists of 4 actions enabling you to manipulate CSV
file from fastlane
.
π‘ get_csv_translation_requests
Get all the translation info as hash from the CSV file, print the translation_status
if translation_requests found.
get_csv_translation_requests(
repository_name: "crazymanish/example-csv-repo", # Specify the CSV git file repo
file_path: "example.csv" # Specify the CSV file path under the git repo
)
get_csv_translation_requests(
repository_name: "crazymanish/example-csv-repo", # Specify the CSV git file repo
branch_name: "master", # Specify the CSV git branch name (dafault `master`)
file_path: "example.csv", # Specify the CSV file path under the git repo
show_status: true, # Specify the flag whether to show the translation status or not (dafault `true`)
show_headers: "Ticket|Timeline" # Specify the CSV headers, will ignored while printing (dafault `Ticket|Timeline`)
)
π create_csv_translation_request
Add a new translation request entry inside the CSV file. It will append a new row in CSV file and then git commit the CSV file changes.
example_csv_payload = { "Ticket" => "PRJ-3030", "Timeline" => "30 April" }
create_csv_translation_request(
repository_name: "crazymanish/example-csv-repo", # Specify the CSV git file repo
file_path: "example.csv", # Specify the CSV file path under the git repo
payload: example_csv_payload # Specify the CSV payload
)
πrebase_csv_translation_request
Rebase a translation request entry inside the CSV file. It will append a new row top of target branch in CSV file and then git commit the CSV file changes. Very useful in case of resolving conflicts.
rebase_csv_translation_request(
repository_name: "crazymanish/example-csv-repo", # Specify the CSV git file repo
branch_name: "master", #Specify the target branch (default: master)
feature_branch_name: "some_feature_branch", #Specify the feature branch name
file_path: "example.csv", # Specify the CSV file path under the git repo
identifier: "PRJ-3030" # Specify the CSV row identifier
)
βοΈ delete_csv_translation_request
Delete a new translation request entry from the CSV file based on CSV row Identifier. It will delete the matched row from the CSV file and then git commit the CSV file changes.
delete_csv_translation_request(
repository_name: "crazymanish/example-csv-repo", # Specify the CSV git file repo
file_path: "example.csv", # Specify the CSV file path under the git repo
identifier: "PRJ-3030" # Specify the CSV row identifier
)
Example
You have to remember to keep your release notes CSV file up-to-date with translation and let fastlane
do the rest.
desc "Release a iOS appstore build to AppStore iTunesConnect with translated release notes."
lane :release do
gym # Build the app and create .ipa file
version_number = get_version_number # Get project version
# Get translated release notes
release_notes = get_csv_translation_requests(
repository_name: "crazymanish/ios-app-release-notes-csv-repo",
file_path: "release_notes/#{version_number}.csv"
)
UI.message("Got the translated release notes πͺπ»")
UI.message(release_notes)
# TODO: Inject release notes into fastlane `metadata`
deliver # Upload ipa file to iTunesConnect with localized release notes fastlane `metadata`
slack(message: "Hi team, New version #{version_number} is avaliable!) # share on Slack
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 guide.
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 beta deployments and releases for your iOS and Android apps. To learn more, check out fastlane.tools.