You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(gatsby-plugin-manifest): add i18n, localization
* feat(gatsby-plugin-manifest): update readme
* fix(gatsby-plugin-manifest): make map callback prop more readable
Co-Authored-By: CanRau <[email protected]>
* fix(gatsby-plugin-manifest): make find callback prop more readable
Co-Authored-By: CanRau <[email protected]>
* fix(gatsby-plugin-manifest): make find callback prop more readable
Co-Authored-By: CanRau <[email protected]>
* docs(gatsby-plugin-manifest): decrease config header level
Co-Authored-By: CanRau <[email protected]>
* feat(gatsby-plugin-manifest): integrate suggestions by moonmeister
language manifests in the `manifests` prop now merge top level options
as suggested here #13471 (comment)
use option merging style in README
docs: change features as suggested here #13471 (comment)
* feat(gatsby-plugin-manifest): incorporate suggestions
* rename `manifests` to `localize`
* rename `language` to `lang`
* include `lang` in manifest file
* merge root options and locales
* ensure root only merges if it has start_url provided
* always generate root options
* remove regex
* use start_url as matcher
* update docs & test
* docs(gatsby-plugin-manifest): merge moonmeisters description
* feat(gatsby-plugin-manifest): merge moonmeisters naming suggestions
* remove accidentally commited .patch file
* fix: issue when makeManifest is run multiple times it concatenates the cache busting to file name.
* feat: add basic caching so an icon isn't generated multiple times durring a single build.
* fix: overriting manifest icons when using unique images for different locales. require name based cache busting fixes this issue the simplest.
* refactor: modify code to only require name chache busting when a unique icon is specified for a locale in automatic mode
* docs: update docs with link to i18n example
* fix: tests and digest cache bug
Each of these features has extensive configuration available so you're always in control.
14
+
Each of these features has extensive configuration available so you are always in control.
14
15
15
16
## Install
16
17
@@ -56,18 +57,21 @@ There are three modes in which icon generation can function: automatic, hybrid,
56
57
- Favicon - yes
57
58
- Legacy icon support - yes
58
59
- Cache busting - yes
60
+
- Localization - optional
59
61
60
62
- Hybrid - Generate a manually configured set of icons from a single source icon.
61
63
62
64
- Favicon - yes
63
65
- Legacy icon support - yes
64
66
- Cache busting - yes
67
+
- Localization - optional
65
68
66
69
- Manual - Don't generate or pre-configure any icons.
67
70
68
71
- Favicon - never
69
72
- Legacy icon support - yes
70
73
- Cache busting - never
74
+
- Localization - optional
71
75
72
76
**_IMPORTANT:_** For best results, if you're providing an icon for generation it should be...
73
77
@@ -132,6 +136,49 @@ In the manual mode, you are responsible for defining the entire web app manifest
132
136
133
137
### Feature configuration - **Optional**
134
138
139
+
#### Localization configuration
140
+
141
+
Localization allows you to create unique manifests for each localized version of your site. As many languages as you want are supported. Localization requires unique paths for each language (e.g. if your default about page is at `/about`, the german(`de`) version would be `/de/about`)
142
+
143
+
The default site language should be configured in your root plugin options. Any additional languages should be defined in the `localize` array. The root settings will be used as defaults if not overridden in a locale. Any configuration option available in the root is also available in the `localize` array.
144
+
145
+
`lang` and `start_url` are the only _required_ options in the array objects. `name`, `short_name`, and `description` are [recommended](https://www.w3.org/TR/appmanifest/#dfn-directionality-capable-members) to be translated if being used in the default language. All other config options are optional. This is helpful if you want to provide unique icons for each locale.
146
+
147
+
The [`lang` option](https://www.w3.org/TR/appmanifest/#lang-member) is part of the web app manifest specification and thus is required to be a [valid language tag](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry)
148
+
149
+
Using localization requires name based cache busting when using a unique icon in automatic mode for a specific locale. This is automatically enabled if you provide and `icon` in a specific locale without uniquely defining `icons`. If you're using icon creation in hybrid or manual mode for your locales, rememmber to provide unique icon paths.
150
+
151
+
```js
152
+
// in gatsby-config.js
153
+
module.exports= {
154
+
plugins: [
155
+
{
156
+
resolve:`gatsby-plugin-manifest`,
157
+
options: {
158
+
name:`The Cool Application`,
159
+
short_name:`Cool App`,
160
+
description:`The application does cool things and makes your life better.`,
161
+
lang:`en`,
162
+
display:`standalone`,
163
+
icon:`src/images/icon.png`,
164
+
start_url:`/`,
165
+
background_color:`#663399`,
166
+
theme_color:`#fff`,
167
+
localize: [
168
+
{
169
+
start_url:`/de/`,
170
+
lang:`de`,
171
+
name:`Die coole Anwendung`,
172
+
short_name:`Coole Anwendung`,
173
+
description:`Die Anwendung macht coole Dinge und macht Ihr Leben besser.`,
174
+
},
175
+
],
176
+
},
177
+
},
178
+
],
179
+
}
180
+
```
181
+
135
182
#### Iterative icon options
136
183
137
184
The `icon_options` object may be used to iteratively add configuration items to the `icons` array. Any options included in this object will be merged with each object of the `icons` array (custom or default). Key value pairs already in the `icons` array will take precedence over duplicate items in the `icon_options` array.
@@ -224,7 +271,7 @@ Cache busting works by calculating a unique "digest" of the provided icon and mo
224
271
225
272
-**\`query\`** - This is the default mode. File names are unmodified but a URL query is appended to all links. e.g. `icons/icon-48x48.png?digest=abc123`
226
273
227
-
-**\`name\`** - Changes the cache busting mode to be done by file name. File names and links are modified with the icon digest. e.g. `icons/icon-48x48-abc123.png` (only needed if your CDN does not support URL query based cache busting)
274
+
-**\`name\`** - Changes the cache busting mode to be done by file name. File names and links are modified with the icon digest. e.g. `icons/icon-48x48-abc123.png` (only needed if your CDN does not support URL query based cache busting). This mode is required and automatically enabled for a locale's icons if you are providing a unique icon for a specific locale in automatic mode using the localization features.
0 commit comments