Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sets up l10n strings for en locale #5

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## UNRELEASED

- Adds English (`en`) locale strings for static text.

## 1.0.1 (2021-08-26)

- Localization is inappropriate for redirects since it's necessary to be able to redirect from any URL. Previously `autopublish: true` was used by the module, but `localize: false` is more appropriate as it eliminates multiple locale versions altogether. A migration has been added to take care of existing redirects in this transition.
Expand Down
17 changes: 17 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"label": "Redirect",
"pluralLabel": "Redirects",
"originalSlug": "Old URL",
"originalSlugHelp": "Format with leading slash (e.g., /old-url)",
"title": "Description",
"urlType": "Link Type",
"urlTypeInternal": "Internal Page",
"urlTypeExternal": "External URL",
"ignoreQuery": "Ignore query string when matching.",
"newPage": "Page Title",
"external": "URL",
"statusCode": "Redirect Type",
"statusCodeHtmlHelp": "<ul><li>Use <strong>\"Temporary\"</strong> for temporary redirects or for testing purposes.</li><li>Use <strong>\"Permanent\"</strong> after testing, this is an SEO best practice. ⚠️ Search engines will cache these, so check carefully.</li>",
"302": "Temporary (status code 302)",
"301": "Permanent (status code 301)"
}
42 changes: 23 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ module.exports = {
extend: '@apostrophecms/piece-type',
options: {
alias: 'redirect',
label: 'Redirect',
pluralLabel: 'Redirects',
label: 'aposRedirect:label',
pluralLabel: 'aposRedirect:pluralLabel',
searchable: false,
editRole: 'editor',
publishRole: 'editor',
withType: '@apostrophecms/page',
localized: false,
quickCreate: false,
statusCode: 302,
i18n: {
ns: 'aposRedirect',
browser: true
},
openGraph: false, // Disables @apostrophecms/open-graph for redirects
seo: false // Disables @apostrophecms/seo for redirects
},
Expand All @@ -37,47 +41,47 @@ module.exports = {
const add = {
redirectSlug: {
// This is *not* type: 'slug' because we want to let you match any
// goldang nonsense the old site had in there, including mixed case
// nonsense the old site had in there, including mixed case.
type: 'string',
label: 'Old URL',
help: 'Format with leading / such as /old-url',
label: 'aposRedirect:originalSlug',
help: 'aposRedirect:originalSlugHelp',
required: true
},
title: {
label: 'Description',
label: 'aposRedirect:title',
type: 'string',
required: true
},
urlType: {
label: 'Link To',
label: 'aposRedirect:urlType',
type: 'select',
choices: [
{
label: 'Internal Page',
label: 'aposRedirect:urlTypeInternal',
value: 'internal'
},
{
label: 'External URL',
label: 'aposRedirect:urlTypeExternal',
value: 'external'
}
],
def: 'internal'
},
ignoreQueryString: {
label: 'Ignore query string when matching.',
label: 'aposRedirect:ignoreQuery',
type: 'boolean',
def: false
},
_newPage: {
type: 'relationship',
label: 'Page Title',
label: 'aposRedirect:newPage',
withType: '@apostrophecms/page',
if: {
urlType: 'internal'
},
builders: {
// Editors+ set up redirects, so it's OK for non-admins to follow them anywhere
// (they won't actually get access without logging in)
// Editors+ set up redirects, so it's OK for non-admins to follow
// them anywhere (they won't actually get access without logging in)
project: {
slug: 1,
title: 1,
Expand All @@ -87,23 +91,23 @@ module.exports = {
max: 1
},
externalUrl: {
label: 'URL',
label: 'aposRedirect:external',
type: 'url',
if: {
urlType: 'external'
}
},
statusCode: {
label: 'Redirect Type',
label: 'aposRedirect:statusCode',
type: 'radio',
htmlHelp: 'Use <strong>"Temporary"</strong> for temporary redirects or for testing purposes.<br />Use <strong>"Permanent"</strong> after testing, this is an SEO best practice.',
htmlHelp: 'aposRedirect:statusCodeHtmlHelp',
choices: [
{
label: 'Temporary (Status code 302)',
label: 'aposRedirect:302',
value: '302'
},
{
label: 'Permanent (Status code 301, Search engines will cache these, proofread carefully)',
label: 'aposRedirect:301',
value: '301'
}
],
Expand All @@ -113,7 +117,7 @@ module.exports = {

const group = {
basics: {
label: 'Basics',
label: 'apostrophe:basics',
fields: [
'title',
'redirectSlug',
Expand Down