diff --git a/locale/_base/translations.suml b/locale/_base/translations.suml index 2024223d1..f6429511b 100644 --- a/locale/_base/translations.suml +++ b/locale/_base/translations.suml @@ -927,11 +927,12 @@ terms: header: 'Terms of Service' lastUpdate: 'Last Updated' consent: 'By registering you''re accepting the {/terms=Terms of Service}.' - # you can leave the terms untranslated, or translate it (copy it from the English version) and include the following disclaimer: - # translationDisclaimer: > - # The following text is just an auxiliary translation. - # The only legally binding version of the Terms of Service is the English one, available - # {https://en.pronouns.page/terms=here}. + # you can leave the terms untranslated, or translate it (copy it from the English version) + # and include the following disclaimer: + translationDisclaimer: > + The following text is just an auxiliary translation. + The only legally binding version of the Terms of Service is the English one, available + {https://en.pronouns.page/terms=here}. content: intro: > These Terms of Service govern your access to and use of the Service provided on the website diff --git a/src/missingTranslations.js b/src/missingTranslations.js index 43f824c7f..61673fa2c 100644 --- a/src/missingTranslations.js +++ b/src/missingTranslations.js @@ -1,5 +1,7 @@ import { deepGet, deepListKeys } from './helpers.js'; +const localeSpecificFlagAlt = /flags_alt\.-(.+)-/; + export function listMissingTranslations(translations, baseTranslations, config) { const expectedTranslations = [...deepListKeys(baseTranslations)]; @@ -32,6 +34,13 @@ export function listMissingTranslations(translations, baseTranslations, config) return false; } + // disclaimer is only required when optional translations are present for a non-English locale + if ((!has('terms.content') && !has('privacy.content') || config.locale === 'en') && + keyMatches('terms.translationDisclaimer') + ) { + return false; + } + // optional keys if (keyMatches( 'home.welcome', @@ -41,6 +50,10 @@ export function listMissingTranslations(translations, baseTranslations, config) 'contact.team.extra', 'contact.team.join.', 'user.login.help', + 'terms.content.', + 'terms.update.', + 'privacy.content.', + 'privacy.consent.', )) { return false; } @@ -75,6 +88,12 @@ export function listMissingTranslations(translations, baseTranslations, config) return false; } + // locale specific flags + const match = k.match(localeSpecificFlagAlt); + if (match && match[1] !== config.locale) { + return false; + } + if (!config.pronouns.honorifics && keyMatches('pronouns.slashes.pluralHonorific')) { return false; } @@ -103,6 +122,10 @@ export function listMissingTranslations(translations, baseTranslations, config) return false; } + if (config.api === null && keyMatches('profile.header', 'api.example', 'api.query')) { + return false; + } + return true; }); }