Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Use JSON5 for `en.json` (#1949)

Dhruv Bhanushalief8e656cbf3c
diff --git a/.gitignore b/.gitignore
index 0f1b44393..319443fc6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,7 +23,6 @@ vercel.json
.eslintcache
.nuxt
src/locales/*.json
-!src/locales/en.json
.nuxt-storybook
storybook-static
.vercel
diff --git a/README.md b/README.md
index 1aa6f496e..9919dc9d4 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,13 @@ Run the following commands in order to have the code up and running on your mach
# Builds and serves assets with hot-reload
# Automatically invokes pnpm install and pnpm i18n
pnpm dev
+```
+
+If you intend to change any text in the app, you will need to edit `src/locales/scripts/en.json5`. To ensure your changes are reflected immediately, run the following command.
+```bash
+# Watches the en.json5 file and updates the en.json file for every change.
+pnpm i18n:watch-en
```
### Using HTTPS Locally
diff --git a/package.json b/package.json
index a34d7cbba..2c8fa6ecc 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"author": "sebworks",
"private": true,
"scripts": {
- "prepare": "./bin/install-pre-commit.sh",
+ "prepare": "./bin/install-pre-commit.sh && pnpm i18n:get-translations --en-only",
"predev": "pnpm install && pnpm i18n:no-get",
"dev": "pnpm dev:only",
"dev:only": "nuxt --hostname 0.0.0.0",
@@ -55,6 +55,7 @@
"pc:install": "python3 pre-commit.pyz install -t pre-push -t pre-commit",
"pc:lint": "python3 pre-commit.pyz run --all-files",
"i18n": "pnpm i18n:create-locales-list && pnpm i18n:get-translations && pnpm i18n:update-locales",
+ "i18n:watch-en": "pnpm i18n:get-translations --en-only --watch",
"i18n:copy-test-locales": "cp -r test/locales/* src/locales/",
"i18n:no-get": "pnpm i18n:create-locales-list && pnpm i18n:update-locales",
"i18n:create-locales-list": "node src/locales/scripts/create-wp-locale-list",
@@ -110,6 +111,7 @@
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/eslint-parser": "^7.17.0",
+ "@babel/parser": "^7.20.3",
"@babel/preset-env": "^7.1.6",
"@babel/preset-typescript": "^7.16.7",
"@babel/runtime-corejs3": "^7.17.9",
@@ -139,6 +141,7 @@
"autoprefixer": "^10.4.0",
"babel-jest": "^26.6.3",
"babel-loader": "8.2.5",
+ "chokidar": "^3.5.3",
"css-loader": "^5.2.7",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ab81c1309..8af6d0e50 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3,6 +3,7 @@ lockfileVersion: 5.4
specifiers:
'@babel/core': ^7.17.10
'@babel/eslint-parser': ^7.17.0
+ '@babel/parser': ^7.20.3
'@babel/preset-env': ^7.1.6
'@babel/preset-typescript': ^7.16.7
'@babel/runtime-corejs3': ^7.17.9
@@ -53,6 +54,7 @@ specifiers:
babel-loader: 8.2.5
build-url: ^6.0.1
case: ^1.6.3
+ chokidar: ^3.5.3
clipboard: ^2.0.8
cookie-universal-nuxt: ^2.1.5
core-js: ^3.22.1
@@ -158,6 +160,7 @@ dependencies:
devDependencies:
'@babel/core': 7.17.10
'@babel/eslint-parser': 7.17.0_annt2i75qyqp7sfsklqkwkfeaa
+ '@babel/parser': 7.20.3
'@babel/preset-env': 7.16.11_@[email protected]
'@babel/preset-typescript': 7.16.7_@[email protected]
'@babel/runtime-corejs3': 7.17.9
@@ -187,6 +190,7 @@ devDependencies:
autoprefixer: [email protected]
babel-jest: 26.6.3_@[email protected]
babel-loader: 8.2.5_usdhdj5awexcm2e5jtwd44bofa
+ chokidar: 3.5.3
css-loader: [email protected]
eslint: 8.15.0
eslint-config-prettier: [email protected]
@@ -255,7 +259,7 @@ packages:
'@babel/generator': 7.17.10
'@babel/helper-module-transforms': 7.17.7
'@babel/helpers': 7.17.9
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/template': 7.16.7
'@babel/traverse': 7.17.10
'@babel/types': 7.17.10
@@ -281,7 +285,7 @@ packages:
'@babel/helper-compilation-targets': 7.17.10_@[email protected]
'@babel/helper-module-transforms': 7.17.7
'@babel/helpers': 7.17.9
- '@babel/parser': 7.17.10
+ '@babel/parser': 7.20.3
'@babel/template': 7.16.7
'@babel/traverse': 7.17.10
'@babel/types': 7.17.10
@@ -599,22 +603,8 @@ packages:
chalk: 2.4.2
js-tokens: 4.0.0
- /@babel/parser/7.17.10:
- resolution: {integrity: sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ==}
- engines: {node: '>=6.0.0'}
- hasBin: true
- dependencies:
- '@babel/types': 7.17.10
-
- /@babel/parser/7.17.3:
- resolution: {integrity: sha512-7yJPvPV+ESz2IUTPbOL+YkIGyCqOyNIzdguKQuJGnH7bg1WTIifuM21YqokFt/THWh1AkCRn9IgoykTRCBVpzA==}
- engines: {node: '>=6.0.0'}
- hasBin: true
- dependencies:
- '@babel/types': 7.17.0
-
- /@babel/parser/7.18.13:
- resolution: {integrity: sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==}
+ /@babel/parser/7.20.3:
+ resolution: {integrity: sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
@@ -1653,7 +1643,7 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.16.7
- '@babel/parser': 7.17.10
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
/@babel/traverse/7.17.10:
@@ -1666,7 +1656,7 @@ packages:
'@babel/helper-function-name': 7.17.9
'@babel/helper-hoist-variables': 7.16.7
'@babel/helper-split-export-declaration': 7.16.7
- '@babel/parser': 7.17.10
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
debug: 4.3.3
globals: 11.12.0
@@ -1683,21 +1673,14 @@ packages:
'@babel/helper-function-name': 7.16.7
'@babel/helper-hoist-variables': 7.16.7
'@babel/helper-split-export-declaration': 7.16.7
- '@babel/parser': 7.17.3
- '@babel/types': 7.17.0
+ '@babel/parser': 7.20.3
+ '@babel/types': 7.17.10
debug: 4.3.3
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: false
- /@babel/types/7.17.0:
- resolution: {integrity: sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==}
- engines: {node: '>=6.9.0'}
- dependencies:
- '@babel/helper-validator-identifier': 7.16.7
- to-fast-properties: 2.0.0
-
/@babel/types/7.17.10:
resolution: {integrity: sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A==}
engines: {node: '>=6.9.0'}
@@ -1721,12 +1704,14 @@ packages:
/@cspotcode/source-map-consumer/0.8.0:
resolution: {integrity: sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==}
engines: {node: '>= 12'}
+ dev: true
/@cspotcode/source-map-support/0.7.0:
resolution: {integrity: sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==}
engines: {node: '>=12'}
dependencies:
'@cspotcode/source-map-consumer': 0.8.0
+ dev: true
/@csstools/convert-colors/1.4.0:
resolution: {integrity: sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==}
@@ -1875,7 +1860,7 @@ packages:
resolution: {integrity: sha512-rnfA0ScyBXyp9xsSD4EAMGeOh1yv/AE7fhqdAdSOr5X8N39azz257umfRtzNT9sHXAKSSzpCVhIbMAkp5c/gjQ==}
engines: {node: '>= 10.0'}
dependencies:
- '@babel/parser': 7.17.3
+ '@babel/parser': 7.20.3
dev: false
/@intlify/vue-i18n-loader/1.1.0:
@@ -2782,7 +2767,7 @@ packages:
/@nuxtjs/i18n/7.2.0:
resolution: {integrity: sha512-fO/QRMxZ0t6LpYJ7ti6mHc0lsog4SMr7Xll3d45zdVSI7+5eBE1YcoG8yXv1sndGQZoq8k0iD1dXuAJA6UL5ww==}
dependencies:
- '@babel/parser': 7.17.3
+ '@babel/parser': 7.20.3
'@babel/traverse': 7.17.3
'@intlify/vue-i18n-extensions': 1.0.2
'@intlify/vue-i18n-loader': 1.1.0
@@ -4082,7 +4067,7 @@ packages:
dependencies:
'@babel/core': 7.17.10
'@babel/generator': 7.17.10
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/plugin-transform-react-jsx': 7.17.3_@[email protected]
'@babel/preset-env': 7.16.11_@[email protected]
'@babel/traverse': 7.17.10
@@ -4202,7 +4187,7 @@ packages:
resolution: {integrity: sha512-4biZIWWzoWlCarMZmTpqcJNgo/RBesYZwGFbQeXiGYsswuvfWARZnW9RE9aUEMZ4XPn7B1N3EKkWcdcWe/K2tg==}
dependencies:
'@babel/generator': 7.17.10
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/preset-env': 7.16.11_@[email protected]
'@babel/types': 7.17.10
'@mdx-js/mdx': 1.6.22
@@ -4688,15 +4673,19 @@ packages:
/@tsconfig/node10/1.0.8:
resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==}
+ dev: true
/@tsconfig/node12/1.0.9:
resolution: {integrity: sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==}
+ dev: true
/@tsconfig/node14/1.0.1:
resolution: {integrity: sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==}
+ dev: true
/@tsconfig/node16/1.0.2:
resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==}
+ dev: true
/@types/anymatch/3.0.0:
resolution: {integrity: sha512-qLChUo6yhpQ9k905NwL74GU7TxH+9UODwwQ6ICNI+O6EDMExqH/Cv9NsbmcZ7yC/rRXJ/AHCzfgjsFRY5fKjYw==}
@@ -4719,7 +4708,7 @@ packages:
/@types/babel__core/7.1.14:
resolution: {integrity: sha512-zGZJzzBUVDo/eV6KgbE0f0ZI7dInEYvo12Rb70uNQDshC3SkRMb67ja0GgRHZgAX3Za6rhaWlvbDO8rrGyAb1g==}
dependencies:
- '@babel/parser': 7.17.10
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
'@types/babel__generator': 7.6.3
'@types/babel__template': 7.4.1
@@ -4729,8 +4718,8 @@ packages:
/@types/babel__core/7.1.17:
resolution: {integrity: sha512-6zzkezS9QEIL8yCBvXWxPTJPNuMeECJVxSOhxNY/jfq9LxOTHivaYTqr37n9LknWWRTIkzqH2UilS5QFvfa90A==}
dependencies:
- '@babel/parser': 7.17.3
- '@babel/types': 7.17.0
+ '@babel/parser': 7.20.3
+ '@babel/types': 7.17.10
'@types/babel__generator': 7.6.3
'@types/babel__template': 7.4.1
'@types/babel__traverse': 7.14.2
@@ -4745,7 +4734,7 @@ packages:
/@types/babel__template/7.4.1:
resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==}
dependencies:
- '@babel/parser': 7.17.10
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
dev: true
@@ -5420,7 +5409,7 @@ packages:
/@vue/compiler-core/3.2.37:
resolution: {integrity: sha512-81KhEjo7YAOh0vQJoSmAD68wLfYqJvoiD4ulyedzF+OEk/bk6/hx3fTNVfuzugIIaTrOx4PGx6pAiBRe5e9Zmg==}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@vue/shared': 3.2.37
estree-walker: 2.0.2
source-map: 0.6.1
@@ -5436,14 +5425,15 @@ packages:
/@vue/compiler-sfc/2.7.10:
resolution: {integrity: sha512-55Shns6WPxlYsz4WX7q9ZJBL77sKE1ZAYNYStLs6GbhIOMrNtjMvzcob6gu3cGlfpCR4bT7NXgyJ3tly2+Hx8Q==}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
postcss: 8.4.16
source-map: 0.6.1
+ dev: false
/@vue/compiler-sfc/3.2.37:
resolution: {integrity: sha512-+7i/2+9LYlpqDv+KTtWhOZH+pa8/HnX/905MdVmAcI/mPQOBwkHHIzrsEsucyOIZQYMkXUiTkmZq5am/NyXKkg==}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@vue/compiler-core': 3.2.37
'@vue/compiler-dom': 3.2.37
'@vue/compiler-ssr': 3.2.37
@@ -5602,11 +5592,12 @@ packages:
/@vue/devtools-api/6.2.1:
resolution: {integrity: sha512-OEgAMeQXvCoJ+1x8WyQuVZzFo0wcyCmUR3baRVLmKBo1LmYZWMlRiXlux5jd0fqVJu6PfDbOrZItVqUEzLobeQ==}
+ dev: false
/@vue/reactivity-transform/3.2.37:
resolution: {integrity: sha512-IWopkKEb+8qpu/1eMKVeXrK0NLw9HicGviJzhJDEyfxTR9e1WtpnnbYkJWurX6WwoFP0sz10xQg8yL8lgskAZg==}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@vue/compiler-core': 3.2.37
'@vue/shared': 3.2.37
estree-walker: 2.0.2
@@ -5852,10 +5843,12 @@ packages:
acorn: 7.4.1
acorn-walk: 7.2.0
xtend: 4.0.2
+ dev: true
/acorn-walk/7.2.0:
resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==}
engines: {node: '>=0.4.0'}
+ dev: true
/acorn-walk/8.2.0:
resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
@@ -5870,11 +5863,13 @@ packages:
resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==}
engines: {node: '>=0.4.0'}
hasBin: true
+ dev: true
/acorn/8.7.0:
resolution: {integrity: sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==}
engines: {node: '>=0.4.0'}
hasBin: true
+ dev: true
/acorn/8.7.1:
resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==}
@@ -6979,6 +6974,7 @@ packages:
/camelcase-css/2.0.1:
resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==}
engines: {node: '>= 6'}
+ dev: true
/camelcase-keys/2.1.0:
resolution: {integrity: sha512-bA/Z/DERHKqoEOrp+qeGKw1QlvEQkGZSc0XaY6VnTxZr+Kv1G5zFwttpjv8qxZ/sBPT4nthwZaAcsAZTJlSKXQ==}
@@ -7121,21 +7117,6 @@ packages:
- supports-color
optional: true
- /chokidar/3.5.2:
- resolution: {integrity: sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==}
- engines: {node: '>= 8.10.0'}
- dependencies:
- anymatch: 3.1.2
- braces: 3.0.2
- glob-parent: 5.1.2
- is-binary-path: 2.1.0
- is-glob: 4.0.3
- normalize-path: 3.0.0
- readdirp: 3.6.0
- optionalDependencies:
- fsevents: 2.3.2
- dev: true
-
/chokidar/3.5.3:
resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
engines: {node: '>= 8.10.0'}
@@ -7503,7 +7484,7 @@ packages:
lodash: ^4.17.20
marko: ^3.14.4
mote: ^0.2.0
- mustache: ^3.0.0
+ mustache: ^4.0.1
nunjucks: ^3.2.2
plates: ~0.4.11
pug: ^3.0.0
@@ -7672,7 +7653,7 @@ packages:
lodash: ^4.17.20
marko: ^3.14.4
mote: ^0.2.0
- mustache: ^3.0.0
+ mustache: ^4.0.1
nunjucks: ^3.2.2
plates: ~0.4.11
pug: ^3.0.0
@@ -7814,7 +7795,7 @@ packages:
/constantinople/4.0.1:
resolution: {integrity: sha512-vCrqcSIq4//Gx74TXXCGnHpulY1dskqLTFGDmhrGxzeXL8lF8kvXv6mpNWlJj1uD4DW23D4ljAqbY4RRaaUZIw==}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
dev: true
@@ -8313,6 +8294,7 @@ packages:
/csstype/3.1.0:
resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
+ dev: false
/cuint/0.2.2:
resolution: {integrity: sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=}
@@ -8483,6 +8465,7 @@ packages:
/defined/1.0.0:
resolution: {integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=}
+ dev: true
/defu/2.0.4:
resolution: {integrity: sha512-G9pEH1UUMxShy6syWk01VQSRVs3CDWtlxtZu7A+NyqjxaCA4gSlWAKDBx6QiUEKezqS8+DUlXLI14Fp05Hmpwg==}
@@ -8581,6 +8564,7 @@ packages:
acorn-node: 1.8.2
defined: 1.0.0
minimist: 1.2.5
+ dev: true
/devalue/2.0.1:
resolution: {integrity: sha512-I2TiqT5iWBEyB8GRfTDP0hiLZ0YeDJZ+upDxjBfOC2lebO5LezQMv7QvIUTzdb64jQyAKLf1AHADtGN+jw6v8Q==}
@@ -8588,6 +8572,7 @@ packages:
/didyoumean/1.2.2:
resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==}
+ dev: true
/diff-sequences/26.6.2:
resolution: {integrity: sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==}
@@ -8597,6 +8582,7 @@ packages:
/diff/4.0.2:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'}
+ dev: true
/diffie-hellman/5.0.3:
resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==}
@@ -8620,6 +8606,7 @@ packages:
/dlv/1.1.3:
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
+ dev: true
/doctrine/2.1.0:
resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==}
@@ -9587,7 +9574,7 @@ packages:
requiresBuild: true
/fill-range/4.0.0:
- resolution: {integrity: sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=}
+ resolution: {integrity: sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==}
engines: {node: '>=0.10.0'}
dependencies:
extend-shallow: 2.0.1
@@ -9794,7 +9781,7 @@ packages:
'@babel/code-frame': 7.16.7
'@types/json-schema': 7.0.9
chalk: 4.1.2
- chokidar: 3.5.2
+ chokidar: 3.5.3
cosmiconfig: 6.0.0
deepmerge: 4.2.2
eslint: 8.15.0
@@ -10064,7 +10051,7 @@ packages:
dev: true
/glob-parent/3.1.0:
- resolution: {integrity: sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=}
+ resolution: {integrity: sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==}
dependencies:
is-glob: 3.1.0
path-dirname: 1.0.2
@@ -10080,6 +10067,7 @@ packages:
engines: {node: '>=10.13.0'}
dependencies:
is-glob: 4.0.3
+ dev: true
/glob-promise/[email protected]:
resolution: {integrity: sha512-q08RJ6O+eJn+dVanerAndJwIcumgbDdYiUT7zFQl3Wm1xD6fBKtah7H8ZJChj4wP+8C+QfeVy8xautR7rdmKEw==}
@@ -10639,6 +10627,7 @@ packages:
engines: {node: '>=8'}
dependencies:
import-from: 3.0.0
+ dev: true
/import-fresh/2.0.0:
resolution: {integrity: sha1-2BNVwVYS04bGH53dOSLUMEgipUY=}
@@ -10667,6 +10656,7 @@ packages:
engines: {node: '>=8'}
dependencies:
resolve-from: 5.0.0
+ dev: true
/import-local/3.0.3:
resolution: {integrity: sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==}
@@ -10827,7 +10817,7 @@ packages:
has-bigints: 1.0.1
/is-binary-path/1.0.1:
- resolution: {integrity: sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=}
+ resolution: {integrity: sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==}
engines: {node: '>=0.10.0'}
dependencies:
binary-extensions: 1.13.1
@@ -11013,7 +11003,7 @@ packages:
dev: true
/is-glob/3.1.0:
- resolution: {integrity: sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=}
+ resolution: {integrity: sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==}
engines: {node: '>=0.10.0'}
dependencies:
is-extglob: 2.1.1
@@ -11251,7 +11241,7 @@ packages:
engines: {node: '>=8'}
dependencies:
'@babel/core': 7.17.10
- '@babel/parser': 7.17.10
+ '@babel/parser': 7.20.3
'@istanbuljs/schema': 0.1.3
istanbul-lib-coverage: 3.2.0
semver: 6.3.0
@@ -11808,7 +11798,7 @@ packages:
hasBin: true
dependencies:
'@babel/core': 7.17.10
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/plugin-proposal-class-properties': 7.16.7_@[email protected]
'@babel/plugin-proposal-object-rest-spread': 7.17.3_@[email protected]
'@babel/preset-env': 7.16.11_@[email protected]
@@ -12125,6 +12115,7 @@ packages:
/lilconfig/2.0.4:
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
engines: {node: '>=10'}
+ dev: true
/lines-and-columns/1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
@@ -12398,6 +12389,7 @@ packages:
/make-error/1.3.6:
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
+ dev: true
/makeerror/1.0.12:
resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==}
@@ -13213,6 +13205,7 @@ packages:
/object-hash/2.2.0:
resolution: {integrity: sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==}
engines: {node: '>= 6'}
+ dev: true
/object-inspect/1.12.0:
resolution: {integrity: sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==}
@@ -13741,6 +13734,7 @@ packages:
typescript: 4.6.2
vue: 2.7.10
+ dev: false
/pinkie-promise/2.0.1:
resolution: {integrity: sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==}
@@ -14082,6 +14076,7 @@ packages:
dependencies:
camelcase-css: 2.0.1
postcss: 8.4.16
+ dev: true
/postcss-lab-function/2.0.1:
resolution: {integrity: sha512-whLy1IeZKY+3fYdqQFuDBf8Auw+qFuVnChWjmxm/UhHWqNHZx+B99EwxTvGYmUBqe3Fjxs4L1BoZTJmPu6usVg==}
@@ -14113,6 +14108,7 @@ packages:
lilconfig: 2.0.4
ts-node: 10.7.0_cbygeln5s5sjlseyk3kbidkfny
yaml: 1.10.2
+ dev: true
/postcss-loader/3.0.0:
resolution: {integrity: sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==}
@@ -14304,6 +14300,7 @@ packages:
dependencies:
postcss: 8.4.16
postcss-selector-parser: 6.0.9
+ dev: true
/postcss-nesting/7.0.1:
resolution: {integrity: sha512-FrorPb0H3nuVq0Sff7W2rnc3SmIcruVC6YwpcS+k687VxyxO33iE1amna7wHuRVzM8vfiYofXSBHNAZ3QhLvYg==}
@@ -15078,6 +15075,7 @@ packages:
/quick-lru/5.1.1:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
+ dev: true
/ramda/0.21.0:
resolution: {integrity: sha512-HGd5aczYKQXGILB+abY290V7Xz62eFajpa6AtMdwEmQSakJmgSO7ks4eI3HdR34j+X2Vz4Thp9VAJbrCAMbO2w==}
@@ -15504,6 +15502,7 @@ packages:
/resolve-from/5.0.0:
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
engines: {node: '>=8'}
+ dev: true
/resolve-path/1.4.0:
resolution: {integrity: sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=}
@@ -16643,6 +16642,7 @@ packages:
resolve: 1.22.0
transitivePeerDependencies:
- ts-node
+ dev: true
/talkback/3.0.1:
resolution: {integrity: sha512-2/mBW8vhcNw3JN5q8Pvq9QLdd3seks859EVabmRpSev2cyCPX4A7eU87jUnlBDOyXYdXPAflJ7cRkyTHmSKNGQ==}
@@ -16864,7 +16864,7 @@ packages:
kind-of: 3.2.2
/to-regex-range/2.1.1:
- resolution: {integrity: sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=}
+ resolution: {integrity: sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==}
engines: {node: '>=0.10.0'}
dependencies:
is-number: 3.0.0
@@ -16993,6 +16993,7 @@ packages:
typescript: 4.6.2
v8-compile-cache-lib: 3.0.0
yn: 3.1.1
+ dev: true
resolution: {integrity: sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==}
@@ -17105,6 +17106,7 @@ packages:
resolution: {integrity: sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==}
engines: {node: '>=4.2.0'}
hasBin: true
+ dev: true
/ua-parser-js/0.7.31:
resolution: {integrity: sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==}
@@ -17396,6 +17398,7 @@ packages:
/v8-compile-cache-lib/3.0.0:
resolution: {integrity: sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==}
+ dev: true
/v8-compile-cache/2.3.0:
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
@@ -17474,7 +17477,7 @@ packages:
/vue-docgen-api/[email protected]:
resolution: {integrity: sha512-zZLa2TqCid97tIk98A30GnP5N46SfAsJW5p3z1PDYME0UTZWl6nKLcgQLtGfzXYT4bz+dV11cc6FumdGW0QTlA==}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
'@vue/compiler-dom': 3.2.37
'@vue/compiler-sfc': 3.2.37
@@ -17822,6 +17825,7 @@ packages:
dependencies:
'@vue/compiler-sfc': 2.7.10
csstype: 3.1.0
+ dev: false
resolution: {integrity: sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==}
@@ -18110,7 +18114,7 @@ packages:
resolution: {integrity: sha512-RNGKj82nUPg3g5ygxkQl0R937xLyho1J24ItRCBTr/m1YnZkzJy1hUiHUJrc/VlsDQzsCnInEGSg3bci0Lmd4w==}
engines: {node: '>= 10.0.0'}
dependencies:
- '@babel/parser': 7.18.13
+ '@babel/parser': 7.20.3
'@babel/types': 7.17.10
assert-never: 1.2.1
babel-walk: 3.0.0-canary-5
@@ -18323,6 +18327,7 @@ packages:
/yn/3.1.1:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'}
+ dev: true
/yocto-queue/0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
diff --git a/src/locales/README.md b/src/locales/README.md
new file mode 100644
index 000000000..1045e325f
--- /dev/null
+++ b/src/locales/README.md
@@ -0,0 +1,6 @@
+# Locales
+
+The primary internationalisation file is
+[`scripts/en.json5`](./scripts/en.json5). All `.json` files present in this
+directory are re-generated when updating translations, so they should not be
+modified.
diff --git a/src/locales/en.json b/src/locales/en.json
deleted file mode 100644
index 04d742fc6..000000000
--- a/src/locales/en.json
+++ /dev/null
@@ -1,698 +0,0 @@
-{
- "404": {
- "title": "The content you’re looking for seems to have disappeared.",
- "main": "Go to {link} or search for something similar from the field below.",
- "search-placeholder": "Search for content to reuse"
- },
- "hero": {
- "subtitle": "Explore more than 600 million creative works",
- "description": "An extensive library of free stock photos, images, and audio, available for free use.",
- "search": {
- "placeholder": "Search for content"
- },
- "disclaimer": {
- "content": "All {openverse} content is under a {license} or is in the public domain.",
- "license": "Creative Commons license"
- },
- "license-filter": {
- "label": "I want something I can"
- },
- "aria": {
- "search": "search",
- "search-type": "search type"
- }
- },
- "notification": {
- "translation": {
- "text": "The translation for {locale} locale is incomplete. Help us get to 100 percent by {link}.",
- "link": "contributing a translation"
- }
- },
- "header": {
- "home-link": "Home",
- "about-nav-item": "Our Story",
- "source-nav-item": "Sources",
- "search-guide-nav-item": "Search Guide",
- "external-sources-nav-item": "External Sources",
- "privacy-nav-item": "Privacy",
- "feedback-nav-item": "Feedback",
- "support-nav-item": "Support Us",
- "placeholder": "Search all content",
- "aria": {
- "primary": "primary",
- "menu": "menu",
- "search": "search",
- "sr-search": "search button"
- },
- "licenses-nav-item": "The Licenses",
- "about-tab": "About",
- "resources-tab": "Resources",
- "api-nav-item": "API",
- "notification": {
- "text": "{example_notification_text}",
- "dismiss": "Dismiss",
- "okay": "OK"
- },
- "loading": "Loading...",
- "filter-button": {
- "simple": "Filters",
- "with-count": "{count} Filter|{count} Filters"
- },
- "see-results": "See results",
- "back-button": "Go back",
- "content-settings-button": {
- "simple": "Menu",
- "with-count": "Menu. {count} filter applied|Menu. {count} filters applied"
- }
- },
- "navigation": {
- "about": "About",
- "licenses": "Licenses",
- "get-involved": "Get involved",
- "api": "API",
- "privacy": "Privacy",
- "feedback": "Feedback",
- "sources": "Sources",
- "external-sources": "External sources",
- "search-help": "Search help"
- },
- "about": {
- "title": "About {openverse}",
- "description": {
- "content": "{openverse} is a tool that allows openly licensed and public domain works to be discovered and used by everyone."
- },
- "collection": {
- "content": "{openverse} searches across more than 300 million images from open APIs and the {common-crawl} dataset. It goes beyond simple search to aggregate results across multiple public repositories into a single catalog, and facilitates reuse through features like machine-generated tags and one-click attribution."
- },
- "planning": {
- "content": "Currently {openverse} only searches images, with search for audio and video provided through {meta}. But we plan to add additional media types such as open texts and audio, with the ultimate goal of providing access to all 1.4 billion CC licensed and public domain works on the web. All of our code is open source ({frontend}, {api}, {catalog}) and we {community}. You can see what {working}.",
- "meta": "External Sources",
- "frontend": "{openverse} frontend",
- "api": "{openverse} API",
- "catalog": "{openverse} Catalog",
- "community": "welcome community contribution",
- "working": "we’re currently working on"
- },
- "transfer": {
- "content": "{openverse} is the successor to CC Search which was launched by Creative Commons in 2019, after its migration to WordPress in 2021. You can read more about this transition in the official announcements from {creative-commons} and {wordpress}. We remain committed to our goal of tackling discoverability and accessibility of open access media."
- },
- "declaration": {
- "content": "Please note that {openverse} does not verify whether the images are properly CC licensed, or whether the attribution and other licensing information we have aggregated is accurate or complete. Please independently verify the licensing status and attribution information before reusing the content. For more details, read the {terms}.",
- "terms": "{openverse} Terms of Use"
- }
- },
- "sources": {
- "title": "Sources",
- "detail": "Clicking on a {single-name} allows you to browse and filter items within that source.",
- "single-name": "Source",
- "providers": {
- "source": "Source",
- "domain": "Domain",
- "item": "Total items"
- },
- "cc-content": {
- "where": "Where does the content on {openverse} come from?",
- "content": "There is openly licensed content hosted on millions of domains across the breadth of the internet. Our team systematically identifies providers hosting CC-licensed content. If it’s a good fit, we index that content and make it discoverable through {openverse}.",
- "provider": "Some providers have multiple different groupings of content within them. {flickr} has sources ranging from NASA to personal photography. The {smithsonian} comprises a dozen diverse collections. Wikimedia Commons runs the gamut in terms of content, and is used by several Galleries, Libraries, Archives, and Museums highlighting some or all of their digitized collections.",
- "europeana": "{openverse} is especially grateful for the work of {link}, an organization that works to digitize and make discoverable cultural heritage works across Europe. {openverse} is able to index hundreds of valuable sources through a single integration with the {link-api}.",
- "europeana-api": "Europeana API",
- "smithsonian": "Smithsonian Institute"
- },
- "new-content": {
- "next": "How do we decide what sources to add next?",
- "integrate": "We have a never ending list of possible sources to research prior to integration. We ask ourselves questions like:",
- "impact": " What is the impact or importance of this source to our users? If it exists within a provider like Wikimedia Commons, is it valuable for our users to be able to filter by this source directly?",
- "reuse": "Is licensing and attribution information clearly displayed to enable confident reuse?",
- "total-items": "How many new total items or new types of items can we bring to our users through this integration? Some sources are direct integrations, while others may be a source within a source."
- },
- "suggestions": "We appreciate suggestions for new sources from our community of users.",
- "issue-button": "Suggest a new source",
- "aria": {
- "table": "sources table"
- },
- "heading": {
- "image": "Image Sources",
- "audio": "Audio Sources"
- }
- },
- "external-sources-page": {
- "title": "External Sources",
- "intro": "{openverse} is built on top of a catalog that indexes CC-licensed and public domain content from selected sources. Learn more about our {link}.",
- "link": "sources here",
- "license": "However, there are many sources of CC-licensed and public domain media which we aren’t able to surface results from within the {openverse} interface yet. This might be because they do not offer a public API, or that our contributors have not yet had time to integrate them into Openverse. These are valued sources and we want to make sure that you are able to find the best openly licensed materials possible, regardless of where they are located.",
- "new": {
- "title": "Can I suggest new external sources?",
- "content": "Yes, please! Create an {issue} in our GitHub repository or send us an {email} and tell us about the new sources you’d like to see included.",
- "issue": "issue",
- "email": "email"
- },
- "why": {
- "title": "Why did you build this?",
- "content": "For many years, Creative Commons has offered its users a dedicated search portal for searching platforms that have CC licensing filters built in. In fact, this is still maintained at {old}.",
- "old": "oldsearch.creativecommons.org",
- "new": "For users of the legacy CC Meta Search site, the \"External Sources\" feature on {openverse} will look familiar. The goal was to ensure that the functionality is not lost, but is updated and embedded within our new search engine for openly licensed content. In addition, the \"External Sources\" feature builds on this functionality, allowing us to quickly add new external sources as we discover them, and support new content types in the future, as we expand.",
- "aria-label": "feedback",
- "feedback-suggestions": "We hope you enjoy, and if you have suggestions for improvement, leave us {feedback}.",
- "feedback-link": "feedback"
- },
- "relationships": "This functionality also allows us to start conversations and build relationships with sources that may like to be included in {openverse} in the future. Finally, we can also offer external sources of media types we do not include in {openverse} yet, but plan to.",
- "explanation": "You can find links to external sources at the bottom of every {openverse} search results page; on pages for searches which return no results; and on pages for media types we do not yet support but intend to."
- },
- "search-guide": {
- "title": "{openverse} Syntax Guide",
- "intro": "When you search, you can enter special symbols or words to your search term to make your search results more precise.",
- "exact": {
- "title": "Search for an exact match",
- "aria-label": "quote unquote Claude Monet",
- "claude-monet": "\"Claude Monet\"",
- "content": "Put a word or phrase inside quotes. For example, {link}."
- },
- "combine": {
- "title": "Combining terms",
- "description": "If you want to combine terms, you can use the following operators to perform more complex queries",
- "and": "{symbol} signifies AND operation",
- "or": "{symbol} signifies OR operation",
- "negate": "{symbol} negates a single token",
- "prefix": "{symbol} at the end of a term signifies a prefix query",
- "precedence": "{open} and {close} signify precedence",
- "fuzziness": "{symbol} after a word signifies edit distance (fuzziness)",
- "aria-labels": {
- "fuzziness": "tilde N",
- "open": "open parenthesis",
- "close": "close parenthesis",
- "star": "star symbol",
- "minus": "minus symbol",
- "plus": "plus symbol",
- "vertical-bar": "vertical bar symbol"
- }
- },
- "example": {
- "and": {
- "description": "Example: {link}{br} This will search for images related to both dog and cat.",
- "aria-label": "dog plus cat",
- "example": "dog+cat"
- },
- "or": {
- "description": "Example: {link}{br} This will search for images related to dog or cat, but not necessarily both.",
- "aria-label": "dog vertical bar cat",
- "example": "dog|cat"
- },
- "negate": {
- "description": "You can use the {operator} to exclude a search term from the results.",
- "operator-name": "operator (signifies NOT)",
- "operator-aria-label": "minus operator (signifies NOT)",
- "aria-label": "dog minus pug",
- "example": "dog -pug",
- "content": "Example: {link}{br} This will search for images related to dog but won't include results related to 'pug'"
- },
- "prefix": {
- "description": "You can use the {operator-name} to mark a prefix term. This will match anything after the *.",
- "operator-name": "operator (wildcard)",
- "operator-aria-label": "star operator (wildcard)",
- "aria-label": "net star symbol",
- "example": "net*",
- "content": "Example: {link}{br} This will search for images matching anything with 'net'. This might include 'network', 'Netflix', 'Netherlands', etc.."
- },
- "precedence": {
- "description": "You can use parentheses {highlight} to specify precedence of terms or combine more complex queries.",
- "aria-label": "dogs plus open parenthesis corgis vertical bar labrador close parenthesis",
- "example": "dogs + (corgis | labrador)",
- "content": "Example: {link}{br} This will search for images that match dogs that are either corgis or labrador."
- },
- "fuzziness": {
- "description": "You can use {highlight} to specify some fuzzy logic to the term according to the {link} — the number of one character changes that need to be made to one string to make it the same as another string.",
- "link-text": "Levenshtein Edit Distance",
- "aria-label": "theatre tilde 1",
- "example": "theatre~1",
- "content": "Example: {link}{br} This will search for images that match strings close to the term 'theatre' with a difference of one character. Results might include terms with different spellings like 'theater'."
- }
- }
- },
- "feedback": {
- "title": "Feedback",
- "intro": "Thank you for using {openverse}! We welcome your ideas for improving the tool below. To provide regular feedback, join the {slack} channel in the {making-wordpress} Slack workspace.",
- "improve": "Help us Improve",
- "report": "Report a Bug",
- "loading": "Loading...",
- "aria": {
- "cc-usability": "slack cc-usability channel",
- "improve": "help us improve form",
- "report": "report a bug form"
- }
- },
- "error": {
- "occurred": "An error occurred",
- "image-not-found": "Couldn't find image with id {id}",
- "media-not-found": "Couldn't find {mediaType} with id {id}",
- "image": "image",
- "audio": "audio"
- },
- "filters": {
- "title": "Filters",
- "filter-by": "Filter By",
- "licenses": {
- "title": "Licenses",
- "cc0": "CC0",
- "pdm": "Public Domain Mark",
- "by": "BY",
- "by-sa": "BY-SA",
- "by-nc": "BY-NC",
- "by-nd": "BY-ND",
- "by-nc-sa": "BY-NC-SA",
- "by-nc-nd": "BY-NC-ND"
- },
- "license-types": {
- "title": "Use",
- "commercial": "Use commercially",
- "modification": "Modify or adapt"
- },
- "image-providers": {
- "title": "Source"
- },
- "audio-providers": {
- "title": "Source"
- },
- "audio-categories": {
- "title": "Audio category",
- "audiobook": "Audiobook",
- "music": "Music",
- "news": "News",
- "podcast": "Podcast",
- "pronunciation": "Pronunciation",
- "sound_effect": "Sound effects",
- "sound": "Sound effects"
- },
- "image-categories": {
- "title": "Image type",
- "photograph": "Photographs",
- "illustration": "Illustrations",
- "digitized_artwork": "Digitized Artworks"
- },
- "audio-extensions": {
- "title": "Extension",
- "flac": "FLAC",
- "mid": "MID",
- "mp3": "MP3",
- "oga": "OGA",
- "ogg": "OGG",
- "opus": "OPUS",
- "wav": "WAV",
- "webm": "WEBM"
- },
- "image-extensions": {
- "title": "Extension",
- "jpg": "JPEG",
- "png": "PNG",
- "gif": "GIF",
- "svg": "SVG"
- },
- "aspect-ratios": {
- "title": "Aspect ratio",
- "tall": "Tall",
- "wide": "Wide",
- "square": "Square"
- },
- "sizes": {
- "title": "Image size",
- "small": "Small",
- "medium": "Medium",
- "large": "Large"
- },
- "mature": {
- "title": "Search Settings",
- "enable": "Enable Mature Content"
- },
- "lengths": {
- "title": "Duration",
- "shortest": "< 30 sec",
- "short": "30 sec-2 min",
- "medium": "2-10 min",
- "long": "> 10 min"
- },
- "creator": {
- "title": "Search by Creator"
- },
- "search-by": {
- "title": "Search By",
- "creator": "Creator"
- },
- "license-explanation": {
- "license-definition": "License definition",
- "mark-definition": "{mark} definition",
- "more": {
- "license": "{read-more} about this license.",
- "mark": "{read-more} about {mark}.",
- "read-more": "Read more"
- }
- },
- "aria": {
- "remove-filter": "Remove {label} filter"
- }
- },
- "filter-list": {
- "filter-by": "Filter by",
- "hide": "Hide filters",
- "clear": "Clear filters",
- "clear-numbered": "Clear filters ({number})",
- "show": "Show results",
- "category-aria": "filters list for {categoryName} category"
- },
- "browse-page": {
- "all-no-results": "No results",
- "all-result-count": "{localeCount} result|{localeCount} results",
- "all-result-count-more": "Over {localeCount} result|Over {localeCount} results",
- "load": "Load more results",
- "loading": "Loading...",
- "fetching-error": "Error fetching {type}:",
- "search-rating": {
- "content": "Are these results relevant?",
- "yes": "Yes",
- "no": "No",
- "feedback-thanks": "Thank you for the feedback!"
- },
- "search-form": {
- "placeholder": "Search all {type}",
- "image": "images",
- "audio": "audio",
- "video": "videos",
- "model-3d": "3D Models",
- "all": "content",
- "collection-placeholder": "Search this collection",
- "button": "Search",
- "clear": "Clear"
- },
- "license-description": {
- "title": "License CC",
- "by": "Credit the creator.",
- "nc": "Noncommercial uses only.",
- "nd": "No derivatives or adaptations permitted.",
- "sa": "Share adaptations under the same terms.",
- "zero": "This work has been marked as dedicated to the public domain.",
- "pd": "This work is marked as being in the public domain.",
- "sampling-plus": "Samples, mash-ups, creative transformations permitted."
- },
- "aria": {
- "close": "close",
- "scroll": "scroll to top",
- "search": "search",
- "relevance": {
- "yes": "relevant result? answer: yes",
- "no": "relevant result? answer: no"
- },
- "remove-filter": "remove filter",
- "license-explanation": "license explanation",
- "creator": "search by creator"
- }
- },
- "media-details": {
- "reuse": {
- "title": "How to use",
- "description": "Visit the {media}'s website to download and use it. Make sure to credit the creator by showing the attribution information where you are sharing your work.",
- "license-header": "License",
- "tool-header": "Public Domain",
- "audio": "Audio",
- "image": "Image",
- "tool": {
- "content": "Read more about the tool {link}.",
- "link": "here"
- },
- "credit": {
- "generic-title": "This work",
- "actual-title": "\"{title}\"",
- "text": "{title} {creator} {marked-licensed} {license}. {view-legal}",
- "creator-text": "by {creator-name}",
- "marked": "is marked with",
- "licensed": "is licensed under",
- "view-legal-text": "To view {terms-copy}, visit {url}.",
- "terms-text": "the terms",
- "copy-text": "a copy of this license"
- },
- "copy-license": {
- "title": "Credit the creator",
- "rich": "Rich Text",
- "html": "HTML",
- "plain": "Plain text",
- "copy-text": "Copy text",
- "copied": "Copied!"
- },
- "attribution": "This image was marked with a {link} license:"
- },
- "provider-label": "Provider",
- "source-label": "Source",
- "loading": "Loading...",
- "related-error": "Error fetching related media",
- "aria": {
- "attribution": {
- "license": "read more about the license",
- "tool": "read more about the tool"
- },
- "creator-url": "author {name}"
- },
- "image-info": "Image information",
- "audio-info": "Audio information",
- "content-report": {
- "short": "Report",
- "long": "Report this content",
- "form": {
- "disclaimer": "For security purposes, {openverse} collects and retains anonymized IP addresses of those who complete and submit this form.",
- "question": "What is the reason?",
- "dmca": {
- "option": "Infringes copyright",
- "note": "You must fill out this {form} to report copyright infringement. No action will be taken until this form is filled out and submitted. We recommend doing the same at the source, {source}.",
- "form": "DMCA form",
- "open": "Open form"
- },
- "mature": {
- "option": "Contains mature content",
- "sub-label": "Optional",
- "placeholder": "Optionally, provide a description."
- },
- "other": {
- "option": "Other",
- "note": "Describe the issue.",
- "sub-label": "Required",
- "placeholder": "Please enter at least 20 characters."
- },
- "submit": "Report",
- "cancel": "Cancel"
- },
- "success": {
- "title": "Report submitted successfully",
- "note": "Thank you for reporting this content. We recommend doing the same at the source, {source}."
- },
- "failure": {
- "title": "Report could not be submitted",
- "note": "Something went wrong, please try again after some time."
- }
- }
- },
- "single-result": {
- "back": "Back to search results"
- },
- "image-details": {
- "creator": "by {name}",
- "weblink": "Get this image",
- "information": {
- "title": "Image information",
- "type": "Type",
- "provider": "Provider",
- "dimensions": "Dimensions",
- "source": "Source",
- "pixels": "pixels",
- "unknown": "Unknown"
- },
- "related-images": "Related images",
- "aria": {
- "creator-url": "Author {creator}"
- }
- },
- "audio-details": {
- "genre-label": "Genre",
- "related-audios": "Related audio",
- "table": {
- "album": "Album",
- "category": "Type",
- "sample-rate": "Sample Rate",
- "filetype": "Format",
- "provider": "Provider",
- "source": "Source",
- "genre": "Genre"
- },
- "information": "Audio information",
- "weblink": "Get this audio"
- },
- "all-results": {
- "snackbar": {
- "text": "Press {spacebar} to play or pause the track.",
- "spacebar": "Spacebar"
- }
- },
- "audio-results": {
- "snackbar": {
- "text": "Press {spacebar} to play or pause, and {left} & {right} to seek through the track.",
- "spacebar": "Spacebar",
- "left": "←",
- "right": "→"
- }
- },
- "external-sources": {
- "caption": "{openverse} can not guarantee the accuracy of license information. Always verify that the work is actually under a CC license.",
- "button": "Source list",
- "title": "External sources",
- "card": {
- "search": "Not finding what you're looking for? Try external sources",
- "caption": "Click on a source below to directly search other collections of CC-licensed images.{break}Please note that Use filters are not supported for Open Clip Art Library or Nappy."
- },
- "form": {
- "unsupported-title": "{openverse} does not yet support built-in {type} search.",
- "supported-title": "Not finding what you're looking for? Try an external source:",
- "no-results-title": "No {type} results for \"{query}\".",
- "caption": "Click on a source below to directly search other collections of CC-licensed {type}.",
- "types": {
- "image": "image",
- "audio": "audio",
- "video": "video",
- "model-3d": "3D model"
- },
- "types-plural": {
- "image": "images",
- "audio": "audios",
- "video": "videos",
- "model-3d": "3D models"
- }
- }
- },
- "browsers": {
- "chrome": "Chrome",
- "firefox": "Firefox",
- "opera": "Opera",
- "edge": "Edge"
- },
- "waveform": {
- "label": "Audio seek bar",
- "current-time": "{time} second|{time} seconds"
- },
- "audio-thumbnail": {
- "alt": "Cover art for \"{title}\" by {creator}"
- },
- "audio-track": {
- "aria-label": "{title} - Audio Player",
- "aria-label-interactive": "{title} - audio player - press the spacebar to play and pause a preview of the audio",
- "aria-label-interactive-seekable": "{title} - audio player - press the spacebar to play and pause a preview of the audio; use the left and right arrow keys to seek through the track.",
- "messages": {
- "err_aborted": "You aborted playback.",
- "err_network": "A network error occurred.",
- "err_decode": "Could not decode audio.",
- "err_unallowed": "Reproduction not allowed.",
- "err_unknown": "An unexpected error has occurred. Try again in a few minutes or report the item if the issue persists.",
- "err_unsupported": "This audio format is not supported by your browser.",
- "loading": "Loading..."
- },
- "creator": "by {creator}"
- },
- "play-pause": {
- "play": "Play",
- "pause": "Pause",
- "replay": "Replay",
- "loading": "Loading"
- },
- "search": {
- "search": "Search",
- "search-bar-label": "Search for content in {openverse}"
- },
- "license-readable-names": {
- "cc0": "Zero",
- "pdm": "Public Domain Mark",
- "by": "Attribution",
- "by-sa": "Attribution-Share-Alike",
- "by-nc": "Attribution-NonCommercial",
- "by-nd": "Attribution-NoDerivatives",
- "by-nc-sa": "Attribution-NonCommercial-Share-Alike",
- "by-nc-nd": "Attribution-NonCommercial-NoDerivatives",
- "sampling+": "Sampling Plus",
- "nc-sampling+": "NonCommercial Sampling Plus"
- },
- "dropdown-button": {
- "aria": {
- "arrow-label": "Dropdown"
- }
- },
- "migration-notice": {
- "intro": "{cc-search} is now called {openverse} and joins {wordpress} as an open source project.",
- "more": "{read-more} about this announcement.",
- "read": "Read more"
- },
- "download-button": {
- "aria": {
- "dropdown-label": "Select the download file format"
- },
- "download": "Download"
- },
- "interpunct": "•",
- "modal": {
- "close": "Close",
- "aria-close": "Close the modal",
- "close-named": "Close {name}"
- },
- "error-images": {
- "depressed-musician": "A depressed pianist rests their head in their hands.",
- "waiting-for-a-bite": "Three boys sit on a broken log while two of them fish."
- },
- "no-results": {
- "heading": "We couldn't find anything for \"{query}\".",
- "alternatives": "Try a different query or use one of the external sources to expand your search."
- },
- "server-timeout": {
- "heading": "Whoops, it looks like that request took too long to complete. Please try again."
- },
- "search-type": {
- "image": "Images",
- "audio": "Audio",
- "all": "All content",
- "video": "Videos",
- "model-3d": "3D Models",
- "label": "Type of content to search",
- "heading": "Content types",
- "additional": "Coming soon",
- "status-beta": "Beta",
- "see-image": "See all images",
- "see-audio": "See all audio"
- },
- "skip-to-content": "Skip to content",
- "pref-page": {
- "title": "Preferences",
- "non-switchable": {
- "title": "Non-switchable features",
- "desc": "You cannot modify the status of these features."
- },
- "switchable": {
- "title": "Switchable features",
- "desc": "You can toggle these features on or off as you like and your preferences will be saved in a cookie."
- },
- "store-state": "Store state",
- "content-filtering": "Content filtering",
- "explanation": "Shown because {feat-name} is {feat-state}"
- },
- "sketchfab-iframe-title": "{sketchfab} viewer",
- "flag-status": {
- "nonexistent": "Nonexistent",
- "on": "On",
- "off": "Off"
- },
- "footer": {
- "wordpress-affiliation": "Powered by {wordpress}",
- "wip": "\uD83D\uDEA7"
- },
- "language": {
- "language": "Language"
- },
- "recent-searches": {
- "heading": "Recent searches",
- "clear": {
- "text": "Clear",
- "label": "Clear recent searches"
- },
- "none": "No recent searches to show.",
- "disclaimer": "Openverse does not store your recent searches, this information is kept locally in your browser."
- }
-}
diff --git a/src/locales/scripts/create-wp-locale-list.js b/src/locales/scripts/create-wp-locale-list.js
index 06849fd3f..83709d6ff 100644
--- a/src/locales/scripts/create-wp-locale-list.js
+++ b/src/locales/scripts/create-wp-locale-list.js
@@ -57,7 +57,8 @@ function parseLocaleData(rawData) {
const propertyRePatterns = createPropertyRePatterns()
const wpLocaleMatch = rawData.match(wpLocalePattern)
// ugly check to exclude English from the locales list,
- // so we don't overwrite `en.json` later.
+ // so we don't overwrite `en.json` later. See `get-translations.js`
+ // to check how `en.json` file is created.
if (wpLocaleMatch && wpLocaleMatch[1] !== 'en_US') {
const wpLocale = wpLocaleMatch[1]
const data = {}
diff --git a/src/locales/scripts/en.json5 b/src/locales/scripts/en.json5
new file mode 100644
index 000000000..b8bba49f5
--- /dev/null
+++ b/src/locales/scripts/en.json5
@@ -0,0 +1,699 @@
+{
+ '404': {
+ title: 'The content you’re looking for seems to have disappeared.',
+ main: 'Go to {link} or search for something similar from the field below.',
+ 'search-placeholder': 'Search for content to reuse',
+ },
+ hero: {
+ subtitle: 'Explore more than 600 million creative works',
+ description: 'An extensive library of free stock photos, images, and audio, available for free use.',
+ search: {
+ placeholder: 'Search for content',
+ },
+ disclaimer: {
+ content: 'All {openverse} content is under a {license} or is in the public domain.',
+ license: 'Creative Commons license',
+ },
+ 'license-filter': {
+ label: 'I want something I can',
+ },
+ aria: {
+ search: 'search',
+ 'search-type': 'search type',
+ },
+ },
+ notification: {
+ translation: {
+ text: 'The translation for {locale} locale is incomplete. Help us get to 100 percent by {link}.',
+ link: 'contributing a translation',
+ },
+ },
+ header: {
+ 'home-link': 'Home',
+ 'about-nav-item': 'Our Story',
+ 'source-nav-item': 'Sources',
+ 'search-guide-nav-item': 'Search Guide',
+ 'external-sources-nav-item': 'External Sources',
+ 'privacy-nav-item': 'Privacy',
+ 'feedback-nav-item': 'Feedback',
+ 'support-nav-item': 'Support Us',
+ placeholder: 'Search all content',
+ aria: {
+ primary: 'primary',
+ menu: 'menu',
+ search: 'search',
+ 'sr-search': 'search button',
+ },
+ 'licenses-nav-item': 'The Licenses',
+ 'about-tab': 'About',
+ 'resources-tab': 'Resources',
+ 'api-nav-item': 'API',
+ notification: {
+ text: '{example_notification_text}',
+ dismiss: 'Dismiss',
+ okay: 'OK',
+ },
+ loading: 'Loading...',
+ 'filter-button': {
+ simple: 'Filters',
+ 'with-count': '{count} Filter|{count} Filters',
+ },
+ 'see-results': 'See results',
+ 'back-button': 'Go back',
+ 'content-settings-button': {
+ simple: 'Menu',
+ 'with-count': 'Menu. {count} filter applied|Menu. {count} filters applied',
+ },
+ },
+ navigation: {
+ about: 'About',
+ licenses: 'Licenses',
+ 'get-involved': 'Get involved',
+ api: 'API',
+ privacy: 'Privacy',
+ feedback: 'Feedback',
+ sources: 'Sources',
+ 'external-sources': 'External sources',
+ 'search-help': 'Search help',
+ },
+ about: {
+ title: 'About {openverse}',
+ description: {
+ content: '{openverse} is a tool that allows openly licensed and public domain works to be discovered and used by everyone.',
+ },
+ collection: {
+ content: '{openverse} searches across more than 300 million images from open APIs and the {common-crawl} dataset. It goes beyond simple search to aggregate results across multiple public repositories into a single catalog, and facilitates reuse through features like machine-generated tags and one-click attribution.',
+ },
+ planning: {
+ content: 'Currently {openverse} only searches images, with search for audio and video provided through {meta}. But we plan to add additional media types such as open texts and audio, with the ultimate goal of providing access to all 1.4 billion CC licensed and public domain works on the web. All of our code is open source ({frontend}, {api}, {catalog}) and we {community}. You can see what {working}.',
+ meta: 'External Sources',
+ frontend: '{openverse} frontend',
+ api: '{openverse} API',
+ catalog: '{openverse} Catalog',
+ community: 'welcome community contribution',
+ working: 'we’re currently working on',
+ },
+ transfer: {
+ content: '{openverse} is the successor to CC Search which was launched by Creative Commons in 2019, after its migration to WordPress in 2021. You can read more about this transition in the official announcements from {creative-commons} and {wordpress}. We remain committed to our goal of tackling discoverability and accessibility of open access media.',
+ },
+ declaration: {
+ content: 'Please note that {openverse} does not verify whether the images are properly CC licensed, or whether the attribution and other licensing information we have aggregated is accurate or complete. Please independently verify the licensing status and attribution information before reusing the content. For more details, read the {terms}.',
+ terms: '{openverse} Terms of Use',
+ },
+ },
+ sources: {
+ title: 'Sources',
+ detail: 'Clicking on a {single-name} allows you to browse and filter items within that source.',
+ 'single-name': 'Source',
+ providers: {
+ source: 'Source',
+ domain: 'Domain',
+ item: 'Total items',
+ },
+ 'cc-content': {
+ where: 'Where does the content on {openverse} come from?',
+ content: 'There is openly licensed content hosted on millions of domains across the breadth of the internet. Our team systematically identifies providers hosting CC-licensed content. If it’s a good fit, we index that content and make it discoverable through {openverse}.',
+ provider: 'Some providers have multiple different groupings of content within them. {flickr} has sources ranging from NASA to personal photography. The {smithsonian} comprises a dozen diverse collections. Wikimedia Commons runs the gamut in terms of content, and is used by several Galleries, Libraries, Archives, and Museums highlighting some or all of their digitized collections.',
+ europeana: '{openverse} is especially grateful for the work of {link}, an organization that works to digitize and make discoverable cultural heritage works across Europe. {openverse} is able to index hundreds of valuable sources through a single integration with the {link-api}.',
+ 'europeana-api': 'Europeana API',
+ smithsonian: 'Smithsonian Institute',
+ },
+ 'new-content': {
+ next: 'How do we decide what sources to add next?',
+ integrate: 'We have a never ending list of possible sources to research prior to integration. We ask ourselves questions like:',
+ impact: ' What is the impact or importance of this source to our users? If it exists within a provider like Wikimedia Commons, is it valuable for our users to be able to filter by this source directly?',
+ reuse: 'Is licensing and attribution information clearly displayed to enable confident reuse?',
+ 'total-items': 'How many new total items or new types of items can we bring to our users through this integration? Some sources are direct integrations, while others may be a source within a source.',
+ },
+ suggestions: 'We appreciate suggestions for new sources from our community of users.',
+ 'issue-button': 'Suggest a new source',
+ aria: {
+ table: 'sources table',
+ },
+ heading: {
+ image: 'Image Sources',
+ audio: 'Audio Sources',
+ },
+ },
+ 'external-sources-page': {
+ title: 'External Sources',
+ intro: '{openverse} is built on top of a catalog that indexes CC-licensed and public domain content from selected sources. Learn more about our {link}.',
+ link: 'sources here',
+ license: 'However, there are many sources of CC-licensed and public domain media which we aren’t able to surface results from within the {openverse} interface yet. This might be because they do not offer a public API, or that our contributors have not yet had time to integrate them into Openverse. These are valued sources and we want to make sure that you are able to find the best openly licensed materials possible, regardless of where they are located.',
+ new: {
+ title: 'Can I suggest new external sources?',
+ content: 'Yes, please! Create an {issue} in our GitHub repository or send us an {email} and tell us about the new sources you’d like to see included.',
+ issue: 'issue',
+ email: 'email',
+ },
+ why: {
+ title: 'Why did you build this?',
+ content: 'For many years, Creative Commons has offered its users a dedicated search portal for searching platforms that have CC licensing filters built in. In fact, this is still maintained at {old}.',
+ old: 'oldsearch.creativecommons.org',
+ new: 'For users of the legacy CC Meta Search site, the "External Sources" feature on {openverse} will look familiar. The goal was to ensure that the functionality is not lost, but is updated and embedded within our new search engine for openly licensed content. In addition, the "External Sources" feature builds on this functionality, allowing us to quickly add new external sources as we discover them, and support new content types in the future, as we expand.',
+ 'aria-label': 'feedback',
+ 'feedback-suggestions': 'We hope you enjoy, and if you have suggestions for improvement, leave us {feedback}.',
+ 'feedback-link': 'feedback',
+ },
+ relationships: 'This functionality also allows us to start conversations and build relationships with sources that may like to be included in {openverse} in the future. Finally, we can also offer external sources of media types we do not include in {openverse} yet, but plan to.',
+ explanation: 'You can find links to external sources at the bottom of every {openverse} search results page; on pages for searches which return no results; and on pages for media types we do not yet support but intend to.',
+ },
+ 'search-guide': {
+ title: '{openverse} Syntax Guide',
+ intro: 'When you search, you can enter special symbols or words to your search term to make your search results more precise.',
+ exact: {
+ title: 'Search for an exact match',
+ 'aria-label': 'quote unquote Claude Monet',
+ 'claude-monet': '"Claude Monet"',
+ content: 'Put a word or phrase inside quotes. For example, {link}.',
+ },
+ combine: {
+ title: 'Combining terms',
+ description: 'If you want to combine terms, you can use the following operators to perform more complex queries',
+ and: '{symbol} signifies AND operation',
+ or: '{symbol} signifies OR operation',
+ negate: '{symbol} negates a single token',
+ prefix: '{symbol} at the end of a term signifies a prefix query',
+ precedence: '{open} and {close} signify precedence',
+ fuzziness: '{symbol} after a word signifies edit distance (fuzziness)',
+ 'aria-labels': {
+ fuzziness: 'tilde N',
+ open: 'open parenthesis',
+ close: 'close parenthesis',
+ star: 'star symbol',
+ minus: 'minus symbol',
+ plus: 'plus symbol',
+ 'vertical-bar': 'vertical bar symbol',
+ },
+ },
+ example: {
+ and: {
+ description: 'Example: {link}{br} This will search for images related to both dog and cat.',
+ 'aria-label': 'dog plus cat',
+ example: 'dog+cat',
+ },
+ or: {
+ description: 'Example: {link}{br} This will search for images related to dog or cat, but not necessarily both.',
+ 'aria-label': 'dog vertical bar cat',
+ example: 'dog|cat',
+ },
+ negate: {
+ description: 'You can use the {operator} to exclude a search term from the results.',
+ 'operator-name': 'operator (signifies NOT)',
+ 'operator-aria-label': 'minus operator (signifies NOT)',
+ 'aria-label': 'dog minus pug',
+ example: 'dog -pug',
+ content: "Example: {link}{br} This will search for images related to dog but won't include results related to 'pug'",
+ },
+ prefix: {
+ description: 'You can use the {operator-name} to mark a prefix term. This will match anything after the *.',
+ 'operator-name': 'operator (wildcard)',
+ 'operator-aria-label': 'star operator (wildcard)',
+ 'aria-label': 'net star symbol',
+ example: 'net*',
+ content: "Example: {link}{br} This will search for images matching anything with 'net'. This might include 'network', 'Netflix', 'Netherlands', etc..",
+ },
+ precedence: {
+ description: 'You can use parentheses {highlight} to specify precedence of terms or combine more complex queries.',
+ 'aria-label': 'dogs plus open parenthesis corgis vertical bar labrador close parenthesis',
+ example: 'dogs + (corgis | labrador)',
+ content: 'Example: {link}{br} This will search for images that match dogs that are either corgis or labrador.',
+ },
+ fuzziness: {
+ description: 'You can use {highlight} to specify some fuzzy logic to the term according to the {link} — the number of one character changes that need to be made to one string to make it the same as another string.',
+ 'link-text': 'Levenshtein Edit Distance',
+ 'aria-label': 'theatre tilde 1',
+ example: 'theatre~1',
+ content: "Example: {link}{br} This will search for images that match strings close to the term 'theatre' with a difference of one character. Results might include terms with different spellings like 'theater'.",
+ },
+ },
+ },
+ feedback: {
+ title: 'Feedback',
+ intro: 'Thank you for using {openverse}! We welcome your ideas for improving the tool below. To provide regular feedback, join the {slack} channel in the {making-wordpress} Slack workspace.',
+ improve: 'Help us Improve',
+ report: 'Report a Bug',
+ loading: 'Loading...',
+ aria: {
+ 'cc-usability': 'slack cc-usability channel',
+ improve: 'help us improve form',
+ report: 'report a bug form',
+ },
+ },
+ error: {
+ occurred: 'An error occurred',
+ 'image-not-found': "Couldn't find image with id {id}",
+ 'media-not-found': "Couldn't find {mediaType} with id {id}",
+ image: 'image',
+ audio: 'audio',
+ },
+ filters: {
+ title: 'Filters',
+ 'filter-by': 'Filter By',
+ licenses: {
+ title: 'Licenses',
+ cc0: 'CC0',
+ pdm: 'Public Domain Mark',
+ by: 'BY',
+ 'by-sa': 'BY-SA',
+ 'by-nc': 'BY-NC',
+ 'by-nd': 'BY-ND',
+ 'by-nc-sa': 'BY-NC-SA',
+ 'by-nc-nd': 'BY-NC-ND',
+ },
+ 'license-types': {
+ title: 'Use',
+ commercial: 'Use commercially',
+ modification: 'Modify or adapt',
+ },
+ 'image-providers': {
+ title: 'Source',
+ },
+ 'audio-providers': {
+ title: 'Source',
+ },
+ 'audio-categories': {
+ title: 'Audio category',
+ audiobook: 'Audiobook',
+ music: 'Music',
+ news: 'News',
+ podcast: 'Podcast',
+ pronunciation: 'Pronunciation',
+ sound_effect: 'Sound effects',
+ sound: 'Sound effects',
+ },
+ 'image-categories': {
+ title: 'Image type',
+ photograph: 'Photographs',
+ illustration: 'Illustrations',
+ digitized_artwork: 'Digitized Artworks',
+ },
+ 'audio-extensions': {
+ title: 'Extension',
+ flac: 'FLAC',
+ mid: 'MID',
+ mp3: 'MP3',
+ oga: 'OGA',
+ ogg: 'OGG',
+ opus: 'OPUS',
+ wav: 'WAV',
+ webm: 'WEBM',
+ },
+ 'image-extensions': {
+ title: 'Extension',
+ jpg: 'JPEG',
+ png: 'PNG',
+ gif: 'GIF',
+ svg: 'SVG',
+ },
+ 'aspect-ratios': {
+ title: 'Aspect ratio',
+ tall: 'Tall',
+ wide: 'Wide',
+ square: 'Square',
+ },
+ sizes: {
+ title: 'Image size',
+ small: 'Small',
+ medium: 'Medium',
+ large: 'Large',
+ },
+ mature: {
+ title: 'Search Settings',
+ enable: 'Enable Mature Content',
+ },
+ lengths: {
+ title: 'Duration',
+ shortest: '< 30 sec',
+ short: '30 sec-2 min',
+ medium: '2-10 min',
+ long: '> 10 min',
+ },
+ creator: {
+ title: 'Search by Creator',
+ },
+ 'search-by': {
+ title: 'Search By',
+ creator: 'Creator',
+ },
+ 'license-explanation': {
+ 'license-definition': 'License definition',
+ 'mark-definition': '{mark} definition',
+ more: {
+ license: '{read-more} about this license.',
+ mark: '{read-more} about {mark}.',
+ 'read-more': 'Read more',
+ },
+ },
+ aria: {
+ 'remove-filter': 'Remove {label} filter',
+ },
+ },
+ 'filter-list': {
+ 'filter-by': 'Filter by',
+ hide: 'Hide filters',
+ clear: 'Clear filters',
+ 'clear-numbered': 'Clear filters ({number})',
+ show: 'Show results',
+ 'category-aria': 'filters list for {categoryName} category',
+ },
+ 'browse-page': {
+ 'all-no-results': 'No results',
+ 'all-result-count': '{localeCount} result|{localeCount} results',
+ 'all-result-count-more': 'Over {localeCount} result|Over {localeCount} results',
+ load: 'Load more results',
+ loading: 'Loading...',
+ 'fetching-error': 'Error fetching {type}:',
+ 'search-rating': {
+ content: 'Are these results relevant?',
+ yes: 'Yes',
+ no: 'No',
+ 'feedback-thanks': 'Thank you for the feedback!',
+ },
+ 'search-form': {
+ placeholder: 'Search all {type}',
+ image: 'images',
+ audio: 'audio',
+ video: 'videos',
+ 'model-3d': '3D Models',
+ all: 'content',
+ 'collection-placeholder': 'Search this collection',
+ button: 'Search',
+ clear: 'Clear',
+ },
+ 'license-description': {
+ title: 'License CC',
+ by: 'Credit the creator.',
+ nc: 'Noncommercial uses only.',
+ nd: 'No derivatives or adaptations permitted.',
+ sa: 'Share adaptations under the same terms.',
+ zero: 'This work has been marked as dedicated to the public domain.',
+ pd: 'This work is marked as being in the public domain.',
+ 'sampling-plus': 'Samples, mash-ups, creative transformations permitted.',
+ },
+ aria: {
+ close: 'close',
+ scroll: 'scroll to top',
+ search: 'search',
+ relevance: {
+ yes: 'relevant result? answer: yes',
+ no: 'relevant result? answer: no',
+ },
+ 'remove-filter': 'remove filter',
+ 'license-explanation': 'license explanation',
+ creator: 'search by creator',
+ },
+ },
+ 'media-details': {
+ reuse: {
+ title: 'How to use',
+ description: "Visit the {media}'s website to download and use it. Make sure to credit the creator by showing the attribution information where you are sharing your work.",
+ 'license-header': 'License',
+ 'tool-header': 'Public Domain',
+ audio: 'Audio',
+ image: 'Image',
+ tool: {
+ content: 'Read more about the tool {link}.',
+ link: 'here',
+ },
+ credit: {
+ 'generic-title': 'This work',
+ 'actual-title': '"{title}"',
+ text: '{title} {creator} {marked-licensed} {license}. {view-legal}',
+ 'creator-text': 'by {creator-name}',
+ marked: 'is marked with',
+ licensed: 'is licensed under',
+ 'view-legal-text': 'To view {terms-copy}, visit {url}.',
+ 'terms-text': 'the terms',
+ 'copy-text': 'a copy of this license',
+ },
+ 'copy-license': {
+ title: 'Credit the creator',
+ rich: 'Rich Text',
+ html: 'HTML',
+ plain: 'Plain text',
+ 'copy-text': 'Copy text',
+ copied: 'Copied!',
+ },
+ attribution: 'This image was marked with a {link} license:',
+ },
+ 'provider-label': 'Provider',
+ 'source-label': 'Source',
+ loading: 'Loading...',
+ 'related-error': 'Error fetching related media',
+ aria: {
+ attribution: {
+ license: 'read more about the license',
+ tool: 'read more about the tool',
+ },
+ 'creator-url': 'author {name}',
+ },
+ 'image-info': 'Image information',
+ 'audio-info': 'Audio information',
+ 'content-report': {
+ short: 'Report',
+ long: 'Report this content',
+ form: {
+ disclaimer: 'For security purposes, {openverse} collects and retains anonymized IP addresses of those who complete and submit this form.',
+ question: 'What is the reason?',
+ dmca: {
+ option: 'Infringes copyright',
+ note: 'You must fill out this {form} to report copyright infringement. No action will be taken until this form is filled out and submitted. We recommend doing the same at the source, {source}.',
+ form: 'DMCA form',
+ open: 'Open form',
+ },
+ mature: {
+ option: 'Contains mature content',
+ 'sub-label': 'Optional',
+ placeholder: 'Optionally, provide a description.',
+ },
+ other: {
+ option: 'Other',
+ note: 'Describe the issue.',
+ 'sub-label': 'Required',
+ placeholder: 'Please enter at least 20 characters.',
+ },
+ submit: 'Report',
+ cancel: 'Cancel',
+ },
+ success: {
+ title: 'Report submitted successfully',
+ note: 'Thank you for reporting this content. We recommend doing the same at the source, {source}.',
+ },
+ failure: {
+ title: 'Report could not be submitted',
+ note: 'Something went wrong, please try again after some time.',
+ },
+ },
+ },
+ 'single-result': {
+ back: 'Back to search results',
+ },
+ 'image-details': {
+ creator: 'by {name}',
+ weblink: 'Get this image',
+ information: {
+ title: 'Image information',
+ type: 'Type',
+ provider: 'Provider',
+ dimensions: 'Dimensions',
+ source: 'Source',
+ pixels: 'pixels',
+ unknown: 'Unknown',
+ },
+ 'related-images': 'Related images',
+ aria: {
+ 'creator-url': 'Author {creator}',
+ },
+ },
+ 'audio-details': {
+ 'genre-label': 'Genre',
+ 'related-audios': 'Related audio',
+ table: {
+ album: 'Album',
+ category: 'Type',
+ 'sample-rate': 'Sample Rate',
+ filetype: 'Format',
+ provider: 'Provider',
+ source: 'Source',
+ genre: 'Genre',
+ },
+ information: 'Audio information',
+ weblink: 'Get this audio',
+ },
+ 'all-results': {
+ snackbar: {
+ text: 'Press {spacebar} to play or pause the track.',
+ spacebar: 'Spacebar',
+ },
+ },
+ 'audio-results': {
+ snackbar: {
+ text: 'Press {spacebar} to play or pause, and {left} & {right} to seek through the track.',
+ spacebar: 'Spacebar',
+ left: '←',
+ right: '→',
+ },
+ },
+ 'external-sources': {
+ caption: '{openverse} can not guarantee the accuracy of license information. Always verify that the work is actually under a CC license.',
+ button: 'Source list',
+ title: 'External sources',
+ card: {
+ search: "Not finding what you're looking for? Try external sources",
+ caption: 'Click on a source below to directly search other collections of CC-licensed images.{break}Please note that Use filters are not supported for Open Clip Art Library or Nappy.',
+ },
+ form: {
+ 'unsupported-title': '{openverse} does not yet support built-in {type} search.',
+ 'supported-title': "Not finding what you're looking for? Try an external source:",
+ 'no-results-title': 'No {type} results for "{query}".',
+ caption: 'Click on a source below to directly search other collections of CC-licensed {type}.',
+ types: {
+ image: 'image',
+ audio: 'audio',
+ video: 'video',
+ 'model-3d': '3D model',
+ },
+ 'types-plural': {
+ image: 'images',
+ audio: 'audios',
+ video: 'videos',
+ 'model-3d': '3D models',
+ },
+ },
+ },
+ browsers: {
+ chrome: 'Chrome',
+ firefox: 'Firefox',
+ opera: 'Opera',
+ edge: 'Edge',
+ },
+ waveform: {
+ label: 'Audio seek bar',
+ 'current-time': '{time} second|{time} seconds',
+ },
+ 'audio-thumbnail': {
+ alt: 'Cover art for "{title}" by {creator}',
+ },
+ 'audio-track': {
+ 'aria-label': '{title} - Audio Player',
+ 'aria-label-interactive': '{title} - audio player - press the spacebar to play and pause a preview of the audio',
+ 'aria-label-interactive-seekable': '{title} - audio player - press the spacebar to play and pause a preview of the audio; use the left and right arrow keys to seek through the track.',
+ messages: {
+ err_aborted: 'You aborted playback.',
+ err_network: 'A network error occurred.',
+ err_decode: 'Could not decode audio.',
+ err_unallowed: 'Reproduction not allowed.',
+ err_unknown: 'An unexpected error has occurred. Try again in a few minutes or report the item if the issue persists.',
+ err_unsupported: 'This audio format is not supported by your browser.',
+ loading: 'Loading...',
+ },
+ creator: 'by {creator}',
+ },
+ 'play-pause': {
+ play: 'Play',
+ pause: 'Pause',
+ replay: 'Replay',
+ loading: 'Loading',
+ },
+ search: {
+ search: 'Search',
+ 'search-bar-label': 'Search for content in {openverse}',
+ },
+ 'license-readable-names': {
+ cc0: 'Zero',
+ pdm: 'Public Domain Mark',
+ by: 'Attribution',
+ 'by-sa': 'Attribution-Share-Alike',
+ 'by-nc': 'Attribution-NonCommercial',
+ 'by-nd': 'Attribution-NoDerivatives',
+ 'by-nc-sa': 'Attribution-NonCommercial-Share-Alike',
+ 'by-nc-nd': 'Attribution-NonCommercial-NoDerivatives',
+ 'sampling+': 'Sampling Plus',
+ 'nc-sampling+': 'NonCommercial Sampling Plus',
+ },
+ 'dropdown-button': {
+ aria: {
+ 'arrow-label': 'Dropdown',
+ },
+ },
+ 'migration-notice': {
+ intro: '{cc-search} is now called {openverse} and joins {wordpress} as an open source project.',
+ more: '{read-more} about this announcement.',
+ read: 'Read more',
+ },
+ 'download-button': {
+ aria: {
+ 'dropdown-label': 'Select the download file format',
+ },
+ download: 'Download',
+ },
+ interpunct: '•',
+ modal: {
+ close: 'Close',
+ 'aria-close': 'Close the modal',
+ 'close-named': 'Close {name}',
+ },
+ 'error-images': {
+ 'depressed-musician': 'A depressed pianist rests their head in their hands.',
+ 'waiting-for-a-bite': 'Three boys sit on a broken log while two of them fish.',
+ },
+ 'no-results': {
+ heading: 'We couldn\'t find anything for "{query}".',
+ alternatives: 'Try a different query or use one of the external sources to expand your search.',
+ },
+ 'server-timeout': {
+ heading: 'Whoops, it looks like that request took too long to complete. Please try again.',
+ },
+ 'search-type': {
+ image: 'Images',
+ audio: 'Audio',
+ all: 'All content',
+ video: 'Videos',
+ 'model-3d': '3D Models',
+ label: 'Type of content to search',
+ heading: 'Content types',
+ additional: 'Coming soon',
+ 'status-beta': 'Beta',
+ 'see-image': 'See all images',
+ 'see-audio': 'See all audio',
+ },
+ 'skip-to-content': 'Skip to content',
+ 'pref-page': {
+ title: 'Preferences',
+ 'non-switchable': {
+ title: 'Non-switchable features',
+ desc: 'You cannot modify the status of these features.',
+ },
+ switchable: {
+ title: 'Switchable features',
+ desc: 'You can toggle these features on or off as you like and your preferences will be saved in a cookie.',
+ },
+ 'store-state': 'Store state',
+ 'content-filtering': 'Content filtering',
+ explanation: 'Shown because {feat-name} is {feat-state}',
+ },
+ 'sketchfab-iframe-title': '{sketchfab} viewer',
+ 'flag-status': {
+ nonexistent: 'Nonexistent',
+ on: 'On',
+ off: 'Off',
+ },
+ footer: {
+ // Link back to WordPress, the word is replaced by the logo
+ 'wordpress-affiliation': 'Powered by {wordpress}',
+ wip: '\uD83D\uDEA7',
+ },
+ language: {
+ language: 'Language',
+ },
+ 'recent-searches': {
+ heading: 'Recent searches',
+ clear: {
+ text: 'Clear',
+ label: 'Clear recent searches',
+ },
+ none: 'No recent searches to show.',
+ disclaimer: 'Openverse does not store your recent searches, this information is kept locally in your browser.',
+ },
+}
diff --git a/src/locales/scripts/get-translations.js b/src/locales/scripts/get-translations.js
index 8a7be5c4c..6672675da 100644
--- a/src/locales/scripts/get-translations.js
+++ b/src/locales/scripts/get-translations.js
@@ -3,12 +3,15 @@
* convert to our JSON format, and save in the correct folder.
*/
const { writeFile } = require('fs/promises')
+const { writeFileSync } = require('fs')
const os = require('os')
+const chokidar = require('chokidar')
+
const axios = require('./axios')
const jed1xJsonToJson = require('./jed1x-json-to-json')
-const localeJSON = require('./wp-locales.json')
+const { parseJson } = require('./read-i18n')
/**
*
@@ -108,8 +111,35 @@ const fetchAndConvertJed1xTranslations = (locales) => {
.then(writeLocaleFiles)
}
-fetchAndConvertJed1xTranslations(Object.values(localeJSON).map((i) => i.slug))
- .then((res) => {
- console.log(`Successfully saved ${res.length} translations.`)
- })
- .catch(console.error)
+/**
+ * Write `en.json` from `en.json5`.
+ */
+const writeEnglish = () => {
+ const rootEntry = parseJson('en.json5')
+ writeFileSync(
+ process.cwd() + '/src/locales/en.json',
+ JSON.stringify(rootEntry, null, 2) + os.EOL
+ )
+ console.log('Successfully saved English translation to en.json.')
+}
+
+writeEnglish()
+if (process.argv.includes('--watch')) {
+ console.log('Watching en.json5 for changes...')
+ chokidar
+ .watch(process.cwd() + '/src/locales/scripts/en.json5')
+ .on('all', (event, path) => {
+ console.log(`Event '${event}' for file ${path}`)
+ writeEnglish()
+ })
+}
+
+if (!process.argv.includes('--en-only')) {
+ const localeJSON = require('./wp-locales.json')
+
+ fetchAndConvertJed1xTranslations(Object.values(localeJSON).map((i) => i.slug))
+ .then((res) => {
+ console.log(`Successfully saved ${res.length + 1} translations.`)
+ })
+ .catch(console.error)
+}
diff --git a/src/locales/scripts/json-pot-helpers.js b/src/locales/scripts/json-pot-helpers.js
index 5df1196c6..ab206774e 100644
--- a/src/locales/scripts/json-pot-helpers.js
+++ b/src/locales/scripts/json-pot-helpers.js
@@ -1,76 +1,70 @@
-// More about the structure of .po files:
-// https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files
-
-/*
+/**
+ * More about the structure of .po files:
+ * // https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files
+ *
+ * ```po
* white-space
- # translator-comments
- #. extracted-comments
- #: reference…
- #, flag…
- #| msgid previous-untranslated-string
- msgid untranslated-string
- msgstr translated-string
+ * # translator-comments
+ * #. extracted-comments
+ * #: reference…
+ * #, flag…
+ * #| msgid previous-untranslated-string
+ * msgid untranslated-string
+ * msgstr translated-string
+ * ```
*/
-const { getAllPaths, getKeyValue } = require('./json-helpers')
+
const { getParsedVueFiles } = require('./parse-vue-files')
-const curlyRegex = new RegExp('{[a-zA-Z-]*}')
-const containsCurlyWord = (string) => curlyRegex.test(string)
-const checkStringForVars = (string) =>
- containsCurlyWord(string) ? 'Do not translate words between ### ###.' : ''
+const PARSED_VUE_FILES = getParsedVueFiles('**/*.?(js|vue)')
-/**
- * For GlotPress to display warning when the translators try to
- * replace placeholders with something else, we need to wrap the
- * placeholders with `###WORD###`
- * @param string
- * @return {string}
- */
-const replaceVarsPlaceholders = (string) => {
- if (!containsCurlyWord(string)) {
- return string
- }
- const variable = /{(?<variable>[a-zA-Z-]*)}/g
- return string.replace(variable, `###$<variable>###`)
-}
+/** @param str {string} */
+const escapeQuotes = (str) => str.replace(/"/g, '\\"')
-/**
- * Replace placeholder format for variables,
- * escape quotes (in a different PR)
- * @param string
- * @return {string}
- */
-const processValue = (string) => {
- return escapeQuotes(replaceVarsPlaceholders(string))
-}
+/** @param str {string} */
+const containsCurlyWord = (str) => /\{[a-zA-Z-]*}/.test(str)
-const PARSED_VUE_FILES = getParsedVueFiles('**/*.?(js|vue)')
+/** @param str {string} */
+const checkStringForVars = (str) =>
+ containsCurlyWord(str) ? '#. Do not translate words between ### ###.' : ''
/**
- * Returns the comment with a reference github link to the line where the
- * string is used, if available. Example:
- * #: /components/HeroSection.vue:L6
- * @param {string} keyPath (eg."hero.title")
- * @return {string}
+ * For GlotPress to display warning when the translators miss the placeholders
+ * or try replacing them with something else, we need to surround the
+ * placeholders with `###`.
+ *
+ * @param str {string} the translation string
+ * @return {string} the translation string with all placeholders marked
*/
-const getRefComment = (keyPath) => {
- const keyValue = PARSED_VUE_FILES.find((k) => k.path === keyPath)
- return keyValue ? `\n#: ${keyValue.file}:${keyValue.line}` : ''
+const replaceVarsPlaceholders = (str) => {
+ if (!containsCurlyWord(str)) return str
+
+ const variable = /\{(?<variable>[a-zA-Z-]*)}/g
+ return str.replace(variable, `###$<variable>###`)
}
-const escapeQuotes = (str) => str.replace(/"/g, '\\"')
+/**
+ * Replace placeholder format for variables and escape quotes.
+ *
+ * @param str {string} the translation string
+ * @return {string} the translation string with quotes escaped and placeholders marked
+ */
+const processValue = (str) => escapeQuotes(replaceVarsPlaceholders(str))
/**
- * String values that need to be pluralized contain {count},
- * {time} or {localeCount},
- * and a pipe symbol.
+ * Returns a comment with all reference to the file and line where the string is
+ * used. These are prefixed with `#:`.
+ *
+ * @param keyPath {string} the lineage of the entry to search in Vue files
+ * @return {string[]} the list of reference comments
*/
-const pluralizedRegex = new RegExp(/(count|time)/i)
+const getRefComments = (keyPath) =>
+ PARSED_VUE_FILES.filter((k) => k.path === keyPath).map(
+ (item) => `#: ${item.file}:${item.line}`
+ )
-const pot_creation_date = () => {
- const today = new Date()
- return `${today.toISOString().split('.')[0]}+00:00`
-}
+const pot_creation_date = () =>
+ `${new Date().toISOString().split('.')[0]}+00:00`
const POT_FILE_META = `# Copyright (C) 2021
# This file is distributed under the same license as Openverse.
@@ -87,44 +81,73 @@ msgstr ""
"Language-Team: LANGUAGE <[email protected]>\\n"
`
-// POT Syntax
-
-// msgctxt context
-// msgid untranslated-string
-// msgstr translated-string
-
-function potTime(json) {
- let potFileString = ''
- const jsonKeys = getAllPaths(json)
- jsonKeys.forEach((key) => {
- const value = getKeyValue(key, json)
- if (value.indexOf('|') > -1 && pluralizedRegex.test(value)) {
- const pluralizedValues = value.split('|')
- if (pluralizedValues.length === 1) {
- pluralizedValues.push(pluralizedValues[0])
- }
- potFileString = `${potFileString}
-${
- checkStringForVars(value) ? `\n#. ${checkStringForVars(value)}` : ''
-}${getRefComment(key)}
-msgctxt "${key}"
-msgid "${processValue(pluralizedValues[0])}"
-msgid_plural "${processValue(pluralizedValues[1])}"
-msgstr[0] ""
-msgstr[1] ""`
- } else {
- potFileString = `${potFileString}
-${
- checkStringForVars(value) ? `\n#. ${checkStringForVars(value)}` : ''
-}${getRefComment(key)}
-msgctxt "${key}"
-msgid "${processValue(value)}"
-msgstr ""`
+/**
+ * Generate the comment for the POT entry. This includes any comment written on
+ * the JSON entry, a message about `###` and finally references to where that
+ * entry is used in the codebase.
+ *
+ * @param entry {import('./read-i18n').Entry} the entry to get the comment for
+ * @return {string} the comment lines
+ */
+const getComment = (entry) => {
+ const comment = []
+
+ // comments given by the programmer, directed at the translator (#.)
+ if (entry.doc) comment.push(`#. ${entry.doc}`)
+
+ // comments given by the programmer, directed at the translator (#.)
+ let vars = checkStringForVars(entry.value)
+ if (vars) comment.push(vars)
+
+ // comments containing references to the program’s source code (#:)
+ let refComments = getRefComments(entry.lineage)
+ if (refComments.length) comment.push(...refComments)
+
+ return comment.map((item) => `${item}`).join('\n')
+}
+
+/**
+ * Convert a JSON entry into a POT entry. If the JSON entry has nested entries,
+ * recursively convert them as well.
+ *
+ * @param entry {import('./read-i18n').Entry} the entry to convert to POT
+ * @return {string} the POT equivalent of the JSON entry
+ */
+const toPot = (entry) => {
+ if (!entry.value) {
+ // string-object type mapping
+ return entry.children.map((child) => toPot(child)).join('\n\n')
+ }
+
+ // string-string type mapping
+ let poEntry = []
+ let comment = getComment(entry)
+ if (comment) poEntry.push(comment)
+ poEntry.push(`msgctxt "${entry.lineage}"`)
+ if (entry.value.includes('|') && /(count|time)/i.test(entry.value)) {
+ const pluralizedValues = entry.value.split('|')
+ if (pluralizedValues.length === 1) {
+ pluralizedValues.push(pluralizedValues[0])
}
- })
- return potFileString
+ poEntry.push(
+ `msgid "${processValue(pluralizedValues[0])}"`,
+ `msgid_plural "${processValue(pluralizedValues[1])}"`,
+ 'msgstr[0] ""',
+ 'msgstr[1] ""'
+ )
+ } else {
+ poEntry.push(`msgid "${processValue(entry.value)}"`, 'msgstr ""')
+ }
+ return poEntry.join('\n')
}
-const createPotFile = (json) => `${POT_FILE_META}${potTime(json)}\n`
+/**
+ * Given the root entry generated by `read-i18n.parseJson`, this function
+ * returns the complete text to output to the Openverse POT file.
+ *
+ * @param entry {import('./read-i18n').Entry} the root entry of the JSON file
+ * @return {string} the text content of the Openverse POT file
+ */
+const makePot = (entry) => [POT_FILE_META, toPot(entry)].join('\n')
-module.exports = { createPotFile, replaceVarsPlaceholders }
+module.exports = { replaceVarsPlaceholders, makePot }
diff --git a/src/locales/scripts/json-to-pot.js b/src/locales/scripts/json-to-pot.js
index 12ac30166..6329778b0 100644
--- a/src/locales/scripts/json-to-pot.js
+++ b/src/locales/scripts/json-to-pot.js
@@ -1,14 +1,14 @@
const fs = require('fs')
const path = require('path')
-const json = require('../en.json')
-
-const { createPotFile } = require('./json-pot-helpers')
+const { parseJson } = require('./read-i18n')
+const { makePot } = require('./json-pot-helpers')
try {
const fileName = path.resolve(process.cwd(), 'openverse.pot')
- fs.writeFileSync(fileName, createPotFile(json), { flag: 'w' })
+ const entries = parseJson('en.json5')
+ fs.writeFileSync(fileName, makePot(entries), { flag: 'w' })
console.log(`Successfully wrote pot file to ${fileName}`)
} catch (err) {
console.error(err)
diff --git a/src/locales/scripts/read-i18n.js b/src/locales/scripts/read-i18n.js
new file mode 100644
index 000000000..6379341ba
--- /dev/null
+++ b/src/locales/scripts/read-i18n.js
@@ -0,0 +1,164 @@
+/**
+ * In `en.json` we use a limited version of JSON5. It is valid JSON5 but only
+ * uses a limited set of features and syntax. This package provides functions
+ * to read this format and convert it into regular JSON.
+ *
+ * The JSON5 file is converted to an AST by Babel, treating it as a JavaScript
+ * `ObjectExpression` which is then converted into an `Entry` instance, which
+ * is capable of emitting regular JSON.
+ *
+ * @typedef {{ [key: string]: string | SimJson }} SimJson
+ */
+
+const fs = require('fs')
+const path = require('path')
+
+const babel = require('@babel/parser')
+
+/**
+ * An `Entry` refers to one i18n translation definition. It can be one of two
+ * types:
+ * - string-string: where the value of the key is one string (e.g. 'key' in
+ * the example above)
+ * - string-object: where the key contains other nested key value pairs (e.g.
+ * 'key-b' in the example above)
+ */
+class Entry {
+ /**
+ * Create a new `Entry` instance with the given key, value and comment.
+ *
+ * @param key {string} the key of the mapping
+ * @param comment {string | undefined} the documentation comment, if any
+ */
+ constructor(key, comment = undefined) {
+ this.key = key // set to '' for the JSON top-level object
+ this.doc = comment
+
+ this.value = undefined // populated for string-string entries, `undefined` otherwise
+ this.children = [] // populated for string-object entries, `[]` otherwise
+ this.ancestors = []
+ }
+
+ /**
+ * Get the fully qualified name of the instance w.r.t. the root `Entry`.
+ *
+ * @return {string} the dot separated path to this entry
+ */
+ get lineage() {
+ return [...this.ancestors.filter((item) => item), this.key].join('.')
+ }
+
+ /**
+ * Register the given entry as a child of this one. Adds this entry and its
+ * ancestors to the child's ancestry.
+ *
+ * @param child {Entry} the child to register
+ */
+ addChild(child) {
+ child.ancestors.push(...this.ancestors, this.key)
+ this.children.push(child)
+ }
+
+ /**
+ * Get the JSON representation of this entry and all its children. This
+ * conversion loses information present in comments.
+ *
+ * @return {SimJson} a POJSO containing the translation mappings
+ */
+ toJSON() {
+ // This is a string-string entry, will be handled by parent.
+ if (this.value) return {}
+
+ /** @type {SimJson} */
+ const pojo = {}
+ for (const child of this.children) {
+ if (child.value) pojo[child.key] = child.value
+ else pojo[child.key] = child.toJSON()
+ }
+ return pojo
+ }
+}
+
+/**
+ * Determine the key for the entry, which will be a string literal if quoted,
+ * or an identifier if not quoted.
+ *
+ * @param keyNode {import('@babel/types').StringLiteral|import('@babel/types').Identifier}
+ * @return {string} the text content of the key
+ */
+const parseKey = (keyNode) => {
+ if (keyNode === undefined) return ''
+ switch (keyNode.type) {
+ case 'StringLiteral':
+ return keyNode.value
+ case 'Identifier':
+ return keyNode.name
+ }
+}
+
+/**
+ * Parse a single or multi-line comment. If the comment is multi-line, newlines
+ * and asterisks will be removed from the output.
+ *
+ * @param commentNode {import('@babel/types').CommentLine|import('@babel/types').CommentBlock}
+ * @return {string} the text content of the comment
+ */
+const parseComment = (commentNode) => {
+ switch (commentNode.type) {
+ case 'CommentLine':
+ return commentNode.value.trim()
+ case 'CommentBlock':
+ return commentNode.value
+ .replace(/\n|\*+/g, '')
+ .replace(/\s+/, ' ')
+ .trim()
+ }
+}
+
+/**
+ * Populate the value or children of the `Entry` depending on whether the value
+ * is a string or an object expression.
+ *
+ * @param entry {Entry} the entry to populate
+ * @param valueNode {import('@babel/types').StringLiteral|import('@babel/types').ObjectExpression}
+ */
+const parseValue = (entry, valueNode) => {
+ switch (valueNode.type) {
+ case 'StringLiteral':
+ entry.value = valueNode.value
+ break
+ case 'ObjectExpression':
+ valueNode.properties.map(parseObjProperty).forEach((child) => {
+ entry.addChild(child)
+ })
+ break
+ }
+}
+
+/**
+ * Create an `Entry` instance by parsing the AST node from Babel.
+ *
+ * @param node {import('@babel/types').ObjectProperty}
+ * @return {Entry} the entry generated by parsing the node
+ */
+const parseObjProperty = (node) => {
+ let key = parseKey(node.key)
+ let comments = node.leadingComments?.map(parseComment).join('')
+ let entry = new Entry(key, comments)
+ parseValue(entry, node.value)
+ return entry
+}
+
+/**
+ * Parse the given filename into a tree of `Entry` instances.
+ * @param filename {string} the name of the JSON file to read
+ * @return {Entry} the root `Entry` instance for the top-level JSON object
+ */
+const parseJson = (filename) =>
+ parseObjProperty({
+ value: babel.parseExpression(
+ fs.readFileSync(path.join(__dirname, filename), 'utf-8')
+ ),
+ })
+
+module.exports = { Entry, parseJson }