Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Make i18n setup live #20

Merged
merged 13 commits into from
Apr 16, 2021
Merged

Make i18n setup live #20

merged 13 commits into from
Apr 16, 2021

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Apr 8, 2021

Fixes #13

This PR finishes setting up i18n support for Search using nuxt-i18n module.

The setup uses prefixes for locales (<wpphotos.com>/fr/search). The only exception is English as the default language: it can be accessed with both prefixed and unprefixed URLs (<wpphotos.com>/en/search and <wpphotos.com>/search).

When the user opens the main page without a prefix (eg. wpphotos.com), the site redirects to:

  1. the language of the i18n-redirected cookie if the cookie has already been set before
  2. the browser's language, if it is available
  3. the default, English language.

All paths and routes inside the app were wrapped with special 'localePath' and 'localeRoute' functions that automatically redirect the users to their selected locale.

The locale chooser is temporarily located in the footer. The Russian and French locales are also temporary, and will need to be replaced by correct translations.

This PR also extracts all the text in components and pages that hasn't been extracted before, and adds Documentation.

@obulat obulat requested a review from zackkrida April 12, 2021 13:37
@obulat obulat changed the title Set up i18n Make i18n setup live Apr 12, 2021
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

There are many nice small details here; great work.

CODEBASE.md Outdated Show resolved Hide resolved
Comment on lines +14 to +17
head() {
return this.$nuxtI18nHead({ addSeoAttributes: true })
},
}
Copy link
Member

Choose a reason for hiding this comment

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

Excellent

@@ -4,7 +4,7 @@
<h1 v-if="error.statusCode === 404">
{{ $t('not-found') }}
</h1>
<h1 v-else>An error occurred</h1>
<h1 v-else>{{ $t('error-occurred') }}</h1>
Copy link
Member

Choose a reason for hiding this comment

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

Great idea to translate this 👍

@zackkrida
Copy link
Member

Please remove the french and russian translations, so only english displays in the locale chooser, and then merge.

@obulat obulat merged commit c767cf4 into WordPress:develop Apr 16, 2021
@obulat obulat deleted the i18n-setup branch April 16, 2021 09:53
@zackkrida zackkrida added ♿️ aspect: a11y Concerns related to the project's accessibility ✨ goal: improvement Improvement to an existing user-facing feature labels Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
♿️ aspect: a11y Concerns related to the project's accessibility ✨ goal: improvement Improvement to an existing user-facing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a locale chooser to footer, make i18n live
2 participants