Skip to content

Commit

Permalink
Merge branch 'main' into fix-#1077-event-open-pages-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
zackkrida committed Jun 19, 2023
2 parents 1021fa2 + 5d5f406 commit a64c065
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions api/api/utils/check_dead_links/provider_status_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ class StatusMapping:
# https://github.com/WordPress/openverse/issues/1200
unknown=(429,),
),
europeana=StatusMapping(
# https://github.com/WordPress/openverse/issues/2417
unknown=(429,),
),
)
2 changes: 0 additions & 2 deletions api/env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ SEMANTIC_VERSION=1.0.0
ELASTICSEARCH_URL=es

WATERMARK_ENABLED=True

FILTER_DEAD_LINKS_BY_DEFAULT=False
2 changes: 1 addition & 1 deletion api/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ IS_PROXIED=False
#SENTRY_SAMPLE_RATE=1.0
#SENTRY_DSN=

#FILTER_DEAD_LINKS_BY_DEFAULT=False
FILTER_DEAD_LINKS_BY_DEFAULT=False
ENABLE_FILTERED_INDEX_QUERIES=True
16 changes: 15 additions & 1 deletion frontend/src/locales/scripts/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { writeFile } = require("fs/promises")
const os = require("os")

const { camel } = require("case")

/**
* Mutates an object at the path with the value. If the path
* does not exist, it is created by nesting objects along the
Expand All @@ -23,6 +25,18 @@ exports.setToValue = function setValue(obj, path, value) {
o[a[0]] = value
}

function replacer(_, match) {
// Replace ###<text>### from `po` files with {<text>} in `vue`.
// Additionally, the old kebab-cased keys that can still be in the
// translations are replaced with camelCased keys the app expects.
// TODO: Remove `camel` and warning once all translation strings are updated.
// https://github.com/WordPress/openverse/issues/2438
if (match.includes("-")) {
console.warn("Found kebab-cased key in translation strings:", match)
}
return `{${camel(match)}}`
}

/**
* Replace ###<text>### with {<text>}.
*
Expand All @@ -34,7 +48,7 @@ const replacePlaceholders = (json) => {
return null
}
if (typeof json === "string") {
return json.replace(/###([a-zA-Z-]*)###/g, "{$1}")
return json.replace(/###([a-zA-Z-]*)###/g, replacer)
}
let currentJson = { ...json }

Expand Down

0 comments on commit a64c065

Please sign in to comment.