Skip to content

Commit

Permalink
Update docs on managing translations (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais authored Nov 10, 2022
1 parent 951d58a commit 75d127b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
24 changes: 24 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,27 @@ yarn run start
```

We also provide a `Dockerfile` for easy deployment.

## Managing translations

You should have checked out the https://github.com/ooni/translations
repository.

From inside of `ooni/translations` to update the transifex master copy (this is
done when edits to the master spreadsheet are done), you should run:
```
./update-explorer-source.sh
```

Then when the translations have been done and you want to pull in the
translated versions, run:
```
./update-explorer-translations.sh
```

From inside of the ooni/explorer repo you should then run:
```
yarn run script:build-translations
```

(this assumes you have `ooni/translations` checked out in the parent directory)
9 changes: 3 additions & 6 deletions scripts/build-translations.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
/* eslint-disable no-console */
/* global require */
const glob = require('glob')
const { basename, resolve } = require('path')
// const csvParse = require('csv-parse/lib/sync')
const { basename } = require('path')
const { readFileSync, writeFileSync } = require('fs')

const LANG_DIR = './public/static/lang/'
const DEFAULT_LOCALE = 'en'
const TRANSLATED_STRINGS_DIR = '../translations/explorer'

const supportedLanguages = glob.sync(`${LANG_DIR}/*.json`).map((f) => basename(f, '.json'))
const supportedLanguages = glob.sync(`${TRANSLATED_STRINGS_DIR}/*`).map((f) => basename(f, '.json'))

// Copy latest files from `translations`
supportedLanguages.forEach((lang) => {
console.log('> Getting latest translations for langugae ✨', lang)
console.log('> Getting latest translations for:', lang)
writeFileSync(`${LANG_DIR}/${lang}.json`, readFileSync(`${TRANSLATED_STRINGS_DIR}/${lang}/strings.json`))
})

Expand Down

1 comment on commit 75d127b

@vercel
Copy link

@vercel vercel bot commented on 75d127b Nov 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

explorer – ./

explorer-one.vercel.app
explorer-ooni1.vercel.app
explorer-git-master-ooni1.vercel.app

Please sign in to comment.