Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
G Guides
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ios-general
  • Guides
  • Wiki
  • shared localization

shared localization · Changes

Page history
ar.kalmykov created page: shared localization authored Jun 19, 2017 by Artem Kalmykov's avatar Artem Kalmykov
Show whitespace changes
Inline Side-by-side
Showing with 58 additions and 0 deletions
+58 -0
  • shared-localization.md shared-localization.md +58 -0
  • No files found.
shared-localization.md 0 → 100644
View page @ 1252d60d
**1. Setup Google Doc Sheet**
Create a google doc sheet, it should have the following format:
![Screen_Shot_2017-06-19_at_16.26.27](/uploads/45834523d0a67b5ffe112bd8d324e8aa/Screen_Shot_2017-06-19_at_16.26.27.png)
In order for it to be accessible via the API, it should be public and published to the web. This can be achieved by selecting File -> Publish to the web...
**2. Node.js**
Make sure node.js is installed on your machine. Use the following command:
```
npm -v
```
If it's not installed, go to https://nodejs.org/en/download/ and do it.
**3. Install localization plugin**
Go to https://github.com/xavierha/localize-with-spreadsheet and download the repository. Run
```
npm install localize-with-spreadsheet
```
if it fails, open `package.json` and change name to anything else, e.g. `"name": "localize-with-spreadsheet-test"`
**4. Create update localization script**
In the same folder create `update-localization.js` file. The example content:
```
var Localize = require("localize-with-spreadsheet");
var transformer = Localize.fromGoogleSpreadsheet("GOOGLE_DOC_ID", '*');
transformer.setKeyCol('KEY');
transformer.save("PROJECT_FOLDER/Resources/Base.lproj/Localizable.strings", { valueCol: "EN", format: "ios" });
transformer.save("PROJECT_FOLDER/Resources/ru.lproj/Localizable.strings", { valueCol: "RU", format: "ios" });
```
Replace `GOOGLE_DOC_ID` with the actual google doc ID. it can be found in doc's URL. `KEY` is the column to be used for keys. Replace `PROJECT_FOLDER` with your project's folder real name. Add appropriate languages and paths.
**5. Add it to the project**
Firstly, remove everything from the plugin folder, except of `node_modules` and `update-localization.js`. Then add this folder to the project's root as a folder (not category), so it is added as a blue folder (not yellow). Also, don't associate it with any target, so these files don't get into final application:
![Screen_Shot_2017-06-19_at_16.50.45](/uploads/fcd05773e6eb458c8cfe2516e52008d4/Screen_Shot_2017-06-19_at_16.50.45.png)
**6. Create a run script**
Go to project configuration, select your target and select `Build Phases`. Click `+` button and select `New Run Script Phase`. A new script should appear. Click on its title and rename to `UpdateLocalization`. Expand it and paste:
```
node UpdateLocalization/update-localization.js
```
Now the script should be executed upon each build (including runs).
\ No newline at end of file
Clone repository
  • Swift Code Style
  • automated slack builds
  • continuous integration
  • Home
  • jenkins auto build
  • shared localization
  • versioning rules