Skip to content

Contributing to Cork

David Bureš edited this page Sep 1, 2024 · 2 revisions

Contributing Translations

Before You Begin

  1. Install the latest stable version of Xcode
  2. Get the Cork source code. Go here: https://github.com/buresdv/Cork#instructions, then scroll down to the section Compiling Cork. There, follow these steps:
  • Installing Tuist and Its Prerequisites
  • Compiling Cork (Steps 1, 2 and 3)

Adding a New Language

  1. Open the top-level dropdown called "Cork", which has the App Store logo next to it, in the file browser in Xcode. Then open the Project sub-folder, then Cork; you will see a bunch of folders

  2. Towards the bottom, there's a file called Localizable. Open it:

    If it doesn't open, right-click (or Option-click) on it and select Open As -> String Catalog:

  3. You will see a list of all languages:

  4. At the bottom left of the central window section, click the + (plus) icon:

    This will bring up a list of languages. Select the language you will be translating into

  5. The new language will appear in the list of languages. Click on it:

  6. You will now see a few new columns; you should focus on the column Default Localization and (language you selected, in my case Czech).

  7. Default Localization is the English original, which you can't edit. You have to put your translation into the (language you selected, in my case Czech) column:

  8. Translate everything, and when you're done, do a PR!

Some Protips and Pitfalls

Tip

Some strings are plurals; this means they can have different forms depending on whether the string has the quantity of "Zero", "One", "Two", "Plural", etc. depending on the language.
These are denoted by the dropdown icon; to localize them, expand them and localize all applicable items within. You can also add a quantity that's not present in English (for example, Slovene also has a Dual, along with Singular and Plural):

Contributing Code

Code Style

Cork uses SwiftLint to enforce basic coding style, along with SwiftFormat to automatically format your code. Both configuration files are included in the repo. Before you submit code, make sure your code does not introduce any new SwiftLint warnings. If you have SwiftFormat installed, I'd really appreciate if you ran it on your files with the included configuration file.

Submitting PRs

There are a few rules and tips regarding the submission of PRs:

  • Always submit PRs to main
  • I might change the branch of your PR, depending on what your code adds or changes. Don't be alarmed, this is pretty usual