{"id":21383083,"url":"https://github.com/s0nerik/goloc","last_synced_at":"2025-07-13T13:31:57.561Z","repository":{"id":41402328,"uuid":"125741439","full_name":"s0nerik/goloc","owner":"s0nerik","description":"A flexible tool for application localization using Google Sheets.","archived":false,"fork":false,"pushed_at":"2021-11-22T16:00:49.000Z","size":2225,"stargazers_count":54,"open_issues_count":10,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-06-18T23:17:21.820Z","etag":null,"topics":["android","csv","dart","flutter","golang","google-sheets","i18n","internationalization","intl","ios","json","localization","mobile","tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s0nerik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-18T15:50:26.000Z","updated_at":"2023-11-21T10:52:29.000Z","dependencies_parsed_at":"2022-07-25T22:33:10.446Z","dependency_job_id":null,"html_url":"https://github.com/s0nerik/goloc","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0nerik%2Fgoloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0nerik%2Fgoloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0nerik%2Fgoloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s0nerik%2Fgoloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s0nerik","download_url":"https://codeload.github.com/s0nerik/goloc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225886579,"owners_count":17539832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","csv","dart","flutter","golang","google-sheets","i18n","internationalization","intl","ios","json","localization","mobile","tool"],"created_at":"2024-11-22T11:19:45.373Z","updated_at":"2024-11-22T11:19:45.830Z","avatar_url":"https://github.com/s0nerik.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](docs/images/goloc.png?raw=true)\n\n# goloc\n\n\u003e A flexible tool for application localization using Google Sheets.\n\n## Table of Contents\n\n- [Features](#features)\n- [Supported OS / architectures](#supported-os--architectures)\n- [Supported platforms / formats](#supported-platforms--formats)\n- [Setup](#setup)\n- [Localization document](#localization-document)\n\t- [Localizations sheet](#localizations-sheet)\n\t- [Formats sheet](#formats-sheet)\n- [Usage](#usage)\n\t- [Android](#android)\n\t- [Flutter](#flutter)\n- [macOS Catalina usage notes](#macos-catalina-usage-notes)\n- [License](#license)\n\n## Features\n\n- Easy configuration\n- High configurability\n- Precise error reporting\n- Multiple supported target platforms\n- Customizable format strings\n- Missing localization reports\n\n## Supported OS / architectures\n\n**goloc** can be built for each OS/architecture supported by golang, but release archives\ncontain binaries only for **amd64** architecture for **macOS**, **Linux** and **Windows**.\n\n## Supported formats\n\n- [Android](#android)\n- iOS\n- [Flutter](#flutter)\n- JSON\n\n## Setup\n\n- Download a `goloc.zip` file from the [latest release](https://github.com/s0nerik/goloc/releases/latest) and unpack it into your project's root folder\n- Download `client_secret.json` file from Google API Console and put it inside a newly created `goloc` folder. To do so, follow these steps:\n\t- Open [Google API Console](https://console.developers.google.com)\n\t- Select a project (or create a new one)\n\t- Press `ENABLE APIS AND SERVICES` button\n\t- Find `Google Sheets API`\n\t- Press `ENABLE`\n\t- Go to `Dashboard-\u003eCredentials`\n\t- Press `Create credentials-\u003eService account key`\n\t- Select any type of service account and `JSON` for key type, then press `Create`\n\t- Rename the downloaded file to `client_secret.json` and put it into a `goloc` folder of a project\n- Create a new [localization document](#localization-document)\n- Share your localization document with a service account created previously. To do so, follow these steps:\n\t- Open the `client_secret.json` file\n\t- Copy the `client_email` value\n\t- Open the localization document\n\t- Press `SHARE` button\n\t- Paste the `client_email` value into the `People` input field.\n\n## Localization document\n\nEach localization document consists of **formats** and **localizations** sheets. One localization document can have multiple sheets for both.\n\nThe simplest way to create a new **goloc**-compatible localization document is to copy the [sample spreadsheet](https://docs.google.com/spreadsheets/d/1pmPPYLrHfSGLM-1MPYEGtbb9Z5iHFUL-xqXNFS0DyaM/edit?usp=sharing). However, you can easily create a **goloc**-compatible localization document yourself just by following the simple requirements described below.\n\n### Localizations sheet\n\n![Example localizations sheet](docs/images/localizations_example.jpg?raw=true)\n\nOn the example above you can see a **goloc**-compatible localizations sheet. The rules to make a localizations sheet **goloc**-compatible are:\n\n- First row must contain column names\n- There must be exactly one **key** column and at least one **language** column\n- **Key** column can have any name, but the dafault name is `key`\n- Each **language** column must be named as `lang_\u003clanaguage code\u003e`\n- To define a format string, you can use `{format_name}` in place of the formatted value (each format must be specified in the [formats sheet](#formats-sheet))\n\n### Formats sheet\n\n![Example formats sheet](docs/images/formats_example.jpg?raw=true)\n\nOn the example above you can see a **goloc**-compatible formats sheet. The rules to make a formats sheet **goloc**-compatible are:\n\n- First row must contain column names\n- There must be exactly one **format** column and at least one **platform** column\n- **Format** column can have any name, but the dafault name is `format`\n- Each **platform** column must have a name of a [**goloc**-supported platform](https://github.com/s0nerik/goloc/tree/master/platforms).\n- Empty format name can be used to define a default format (used as `{}`)\n\n## Usage\n\n- Create a script or build task definition with parameters best suited for your project. To see available parameters, run `goloc --help`. **goloc** is distributed in form of separate executables for each platform, so don't forget to take that into account creating localization script.\n- Execute the script/task whenever you want to update localized strings. **goloc** will automatically replace any existing localization files with the updated ones.\n\n### Android\n\nNo special configuration in code is required.\n\nExample **gradle** task specification:\n\n```gradle\ntask \"fetchLocalizations\"(type: Exec) {\n    def osName = System.getProperty('os.name').toLowerCase()\n    def isWindows = osName.contains(\"win\")\n    def isMac = osName.contains(\"mac\")\n    def isUnix = osName.contains(\"nix\") || osName.contains(\"nux\") || osName.contains(\"aix\")\n\n    def params = [\n            '--credentials', \"goloc/client_secret.json\",\n            '--platform', 'android',\n            '--spreadsheet', '1MbtglvGyEey3gH8yh4c9QovCIbtl5EcwqWqTZUiNga8',\n            '--tab', \"localizations\",\n            \"--key-column\", \"key\",\n            '--resources', \"app/src/main/res/\",\n            '--default-localization', 'en',\n            '--default-localization-file-path', \"app/src/main/res/values/localized_strings.xml\"\n    ]\n\n    if (isWindows) {\n        params = ['cmd', '/c', 'goloc\\\\windows_amd64.exe'] + params\n    } else if (isMac) {\n        params = ['./goloc/darwin_amd64'] + params\n    } else if (isUnix) {\n        params = ['./goloc/linux_amd64'] + params\n    } else {\n        logger.error('Your OS is not supported.')\n        return\n    }\n\n    commandLine params\n}\n```\n\n### Flutter\n\nLocalized strings can be accessed through `AppLocalizations.of(context)`\n\nRequirements:\n\n- Add `sprintf: ^4.0.2` to the `dependencies` section of `pubspec.yaml`\n- Add `AppLocalizationsDelegate()` to `localizationsDelegates` of the app widget constructor\n- Specify supported localizations in `supportedLocales` of the app widget constructor\n- (Recommended) Add `DefaultIntlLocaleDelegate()` to `localizationsDelegates` of the app widget constructor. This will make `intl`-dependent formatters use currently selected locale.\n\n```dart\nclass DefaultIntlLocaleDelegate extends LocalizationsDelegate\u003cNull\u003e {\n  @override\n  bool isSupported(Locale locale) =\u003e true;\n\n  @override\n  Future\u003cNull\u003e load(Locale locale) {\n    Intl.defaultLocale = locale.toLanguageTag();\n    return Future.value(null);\n  }\n\n  @override\n  bool shouldReload(LocalizationsDelegate\u003cAppLocalizations\u003e old) =\u003e false;\n}\n```\n\nExample **bash** localization script:\n\n```bash\n#!/bin/bash\n\ncase \"$OSTYPE\" in\n  darwin*)  EXECUTABLE=\"darwin_amd64\" ;;\n  linux*)   EXECUTABLE=\"linux_amd64\" ;;\n  msys*)    EXECUTABLE=\"windows_amd64.exe\" ;;\n  *)\n\t  echo \"Platform is not supported: $OSTYPE\"\n\t  exit 1\n  ;;\nesac\n\ngoloc/${EXECUTABLE} -c goloc/client_secret.json -p flutter -s 1MbtglvGyEey3gH8yh4c9QovCIbtl5EcwqWqTZUiNga8 -t localizations -r lib/intl\n```\n\n## macOS Catalina usage notes\n\nDue to the security improvements in the macOS Catalina, any 3rd party application downloaded from the internet has to be notarized to be launched without additional actions from the user side. Since **goloc** is entirely free, I can't afford Apple Developer Program subscription for notarizing macOS builds. Luckily, Apple has left a way to launch a non-notarized app, but it requires some actions.\n\nHere's the instruction on how to launch **goloc** on macOS Catalina:\n\n1. Upon the first launch you'll see a window like this:![catalina_0](docs/images/catalina_0.png?raw=true)\n2. Go to settings and choose `Security \u0026 Privacy`:![catalina_1](docs/images/catalina_1.png?raw=true)\n3. Choose `Open Anyway`:![catalina_2](docs/images/catalina_2.png?raw=true)\n4. Re-launch **goloc**, and you'll see a next window:![catalina_3](docs/images/catalina_3.png?raw=true)\n5. Choose `Open`. Next time you launch **goloc**, macOS won't complain anymore.\n\n## License\n\nReleased under the [MIT License](https://github.com/s0nerik/goloc/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs0nerik%2Fgoloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs0nerik%2Fgoloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs0nerik%2Fgoloc/lists"}