@graphcommerce/docs 8.0.1 → 8.0.2-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.0.2-canary.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2195](https://github.com/graphcommerce-org/graphcommerce/pull/2195) [`207cd41`](https://github.com/graphcommerce-org/graphcommerce/commit/207cd4147621e53353b0b354c80d575df78089f0) - Documentation on multistore setup added
8
+ ([@paales](https://github.com/paales))
9
+
3
10
  ## 8.0.1
4
11
 
5
12
  ### Patch Changes
@@ -334,7 +334,9 @@ All storefront configuration for the project
334
334
 
335
335
  #### locale: string (required)
336
336
 
337
- Must be a locale string https://www.unicode.org/reports/tr35/tr35-59/tr35.html#Identifiers
337
+ Must be a [locale string](https://www.unicode.org/reports/tr35/tr35-59/tr35.html#Identifiers) for automatic redirects to work.
338
+
339
+ This value can be used as a sub-path identifier only, make sure linguiLocale is configured for each URL.
338
340
 
339
341
  #### magentoStoreCode: string (required)
340
342
 
@@ -390,7 +392,9 @@ Add a gcms-locales header to make sure queries return in a certain language, can
390
392
 
391
393
  #### linguiLocale: string
392
394
 
393
- Specify a custom locale for to load translations.
395
+ Specify a custom locale for to load translations. Must be lowercase valid locale.
396
+
397
+ This value is also used for the Intl.
394
398
 
395
399
  ### MagentoConfigurableVariantValues
396
400
 
@@ -215,6 +215,10 @@ msgstr ""
215
215
  > suggestions in VS Code with the
216
216
  > [Github copilot extention ↗](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot).
217
217
 
218
+ ## Use country specific locales like `en-us` and `en-gb`
219
+
220
+ Configure `linguiLocale` in the storefront config.
221
+
218
222
  ## Next steps
219
223
 
220
224
  - Learn more about
@@ -0,0 +1,100 @@
1
+ # Multi store, language and website setup
2
+
3
+ GraphCommerce builds on top of the
4
+ [Next.js internationalization feature](https://nextjs.org/docs/pages/building-your-application/routing/internationalization#getting-started).
5
+
6
+ ## Sub-path routing
7
+
8
+ Locales are UTS Locale Identifiers, a standardized format for defining locales.
9
+
10
+ Generally a Locale Identifier is made up of a language, region, and script
11
+ separated by a dash: `language-region-script`. The region and script are
12
+ optional. An example how to configure it in GraphCommerce:
13
+
14
+ ```js
15
+ const config = {
16
+ storefront: [
17
+ { locale: 'en-US', defaultLocale: true },
18
+ { locale: 'nl-NL' },
19
+ { locale: 'de' },
20
+ ],
21
+ }
22
+ ```
23
+
24
+ This will result in the following URLs:
25
+
26
+ - `https://www.graphcommerce.org/some-path/here`
27
+ - `https://www.graphcommerce.org/nl-NL/some-path/here`
28
+ - `https://www.graphcommerce.org/de/some-path/here`
29
+
30
+ ## Domain routing
31
+
32
+ The domains can be subdomains or top-level domains. The configuration is the
33
+ same for both.
34
+
35
+ ```js
36
+ const config = {
37
+ storefront: [
38
+ { domain: 'www.graphcommerce.org', locale: 'en-US', defaultLocale: true },
39
+ { domain: 'www.graphcommerce.org', locale: 'fr' },
40
+ { domain: 'www.graphcommerce.nl', locale: 'nl-NL' },
41
+ { domain: 'de.graphcommerce.org', locale: 'de-DE' },
42
+ ],
43
+ }
44
+ ```
45
+
46
+ This will result in the following URLs:
47
+
48
+ - `https://www.graphcommerce.org/some-path/here`
49
+ - `https://www.graphcommerce.org/fr/some-path/here`
50
+ - `https://www.graphcommerce.nl/some-path/here`
51
+ - `https://de.graphcommerce.org/some-path/here`
52
+
53
+ ## Domain routing + same locale
54
+
55
+ Next.js does not allow reusing locales (even if it is on different domains), to
56
+ work around this, we're using the fact that a locale is allowed to have a
57
+ 'script' value in the format: `language-region-script`. We use this part to
58
+ differentiate between the same locales on different domains.
59
+
60
+ Configuring the `linguiLocale` makes sure the correct translation file is loaded
61
+ here.
62
+
63
+ ```js
64
+ const config = {
65
+ storefront: [
66
+ { domain: 'domain1.com', locale: 'en-us-domain1', linguiLocale: 'en' },
67
+ { domain: 'domain2.com', locale: 'en-us-domain2', linguiLocale: 'en' },
68
+ { domain: 'domain3.com', locale: 'en-us-domain3', linguiLocale: 'en' },
69
+ ],
70
+ }
71
+ ```
72
+
73
+ ### Separating Sub-paths from locales
74
+
75
+ Note: Available from GraphCommerce 8.1.0
76
+
77
+ Warning: Separating paths form locales will break Next.js' automatic redirect
78
+ functionality.
79
+
80
+ ```js
81
+ const config = {
82
+ storefront: [
83
+ { locale: 'default', linguiLocale: 'en', defaultLocale: true },
84
+ { locale: 'fr_fr', linguiLocale: 'fr' },
85
+ { locale: 'nl_nl', linguiLocale: 'nl' },
86
+ ],
87
+ }
88
+ ```
89
+
90
+ This will result in the following URLs:
91
+
92
+ - `https://www.graphcommerce.org/some-path/here`
93
+ - `https://www.graphcommerce.org/fr_fr/some-path/here`
94
+ - `https://www.graphcommerce.org/nl_nl/some-path/here`
95
+
96
+ ## Further reading
97
+
98
+ - [Next.js docs: Prefixing the default locale](https://nextjs.org/docs/pages/building-your-application/routing/internationalization#prefixing-the-default-locale)
99
+ - [Next.js docs: Sub-path routing](https://nextjs.org/docs/pages/building-your-application/routing/internationalization#sub-path-routing).
100
+ - [Next.js docs: Domain routing](https://nextjs.org/docs/pages/building-your-application/routing/internationalization#domain-routing)
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "@graphcommerce/docs",
3
3
  "homepage": "https://www.graphcommerce.org/docs",
4
4
  "repository": "github:graphcommerce-org/graphcommerce/docs",
5
- "version": "8.0.1",
5
+ "version": "8.0.2-canary.0",
6
6
  "sideEffects": true,
7
7
  "peerDependencies": {
8
- "@graphcommerce/prettier-config-pwa": "^8.0.1"
8
+ "@graphcommerce/prettier-config-pwa": "^8.0.2-canary.0"
9
9
  },
10
10
  "prettier": "@graphcommerce/prettier-config-pwa"
11
11
  }