Skip to content

kiwicom/stranger-strings

Repository files navigation

Stranger Strings

image

📝 Description

Stranger Strings is open-source Firebase web application for analyzing localisation and exploring inconsistencies and mistakes in translations. It currently supports Github repos with JSON loc files or Phrase loc projects.

config_preview2

✅ Checks:

  • Placeholders - Detects missing / excess / inconsistent placeholders
  • HTML tags - Detects invalid / inconsistent / prohibited HTML tags
  • Length - Detects suspicious variations in length
  • Spelling - Detects spelling mistakes (supported languages can be chosen by enabling dictionaries in config file, uses nspell)
  • Style - Detects stylistic issues – passive voice, weasel words, overuse of adverbs, cliches and similar (available only for english and german translations, uses write-good)
  • Insensitiveness - Detects gender favouring, polarising, race related, religion inconsiderate, or other unequal phrasing (available only for english translations, uses Alex)
  • Values - Detects values, that should/could be replaced by placeholders, because values are likely to change over time
  • First character - Detects inconsistencies of first character
  • Last character - Detects inconsistencies of last character

🛠 Project setup

📌 Requirements

  • Firebase project with (Flame/Blaze Plan*)
  • Firebase Realtime Database
  • GitHub repository with localizations in flat JSON format or Phrase account

* Flame and Blaze plans are required for Google Cloud Functions outbound API calls (e.g. GitHub). Stranger Strings is a very lightweight application so if you choose Blaze plan you shouldn't pay anything at all

🧩 Installation

1. Configure .env file (e.g.:)

# note: select one data source and fill it's data

################ DATASOURCE: PhraseApp ################

VUE_APP_PHRASEAPP_PROJECT_ID="yourPhraseAppProjectID"
VUE_APP_PHRASEAPP_TOKEN="yourPhraseAppToken"

################# DATASOURCE: GitHub ##################

VUE_APP_GITHUB_USER="yourGitHubUserAccontName"
VUE_APP_GITHUB_PASSWORD="youtGitHubUserPassword"
VUE_APP_GITHUB_REPO="https://github.com/yourRepository/yourTranslations"

#######################################################

VUE_APP_FIREBASE_MESSAGING_SENDER_ID="seeImagesBelow"
VUE_APP_FIREBASE_API_KEY="seeImagesBelow"
VUE_APP_FIREBASE_AUTH_DOMAIN="seeImagesBelow"
VUE_APP_FIREBASE_DATABASE_URL="seeImagesBelow"
VUE_APP_FIREBASE_PROJECT_ID="seeImagesBelow"
VUE_APP_FIREBASE_STORAGE_BUCKET="seeImagesBelow"
VUE_APP_FIREBASE_APP_ID="seeImagesBelow"

config_preview2

2. Install dependencies

yarn install --all && yarn --cwd ./functions

3. Login to Firebase and select target project

firebase login
firebase use *your_Firebase_project_ID*

4. (Optional) Adjust access rights and sign-in method in/common/config.js

5. Deploy

yarn deploy

6. Enable sign-in providers accordingly to config const SIGN_IN_METHOD in /common/config.js in Firebase Console (default Anonymous)

authproviderss

💽 Data sources

Stranger Strings supports importing translations from Phrase or GitHub.

:octocat: GitHub repository structure

.
├── en-GB.json              # file containing en-GB localization
├── ...
└── xx-XX.json

:octocat: JSON format

Supports only basic key-value format where key is translation key and value is translation content.

flat form:

{
  ...
  "translation.key": "Translation content 1.",
  "translation.keyTwo": "Translation content 2.",
  "another.translation.key": "Another translation content.",
  ...
}

or nested form:

{
  ...
  "translation": {
    "key": "Translation content 1.",
    "keyTwo": "Translation content 2."
  },
  "another": {
    "translation": {
      "key": "Another translation content."
    }
  },
  ...
}