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

[gatsby-plugin-manifest] internationalization (i18n) #10250

Closed
CanRau opened this issue Dec 3, 2018 · 9 comments · Fixed by #13471
Closed

[gatsby-plugin-manifest] internationalization (i18n) #10250

CanRau opened this issue Dec 3, 2018 · 9 comments · Fixed by #13471
Labels
stale? Issue that may be closed soon due to the original author not responding any more.

Comments

@CanRau
Copy link
Contributor

CanRau commented Dec 3, 2018

I'm quite new to PWAs, manifests & add-to-homescreen stuff and I'm not 100% sure I get everything. I am not even sure where to discuss my thoughts/questions, a RFC seems to big for this, and I'm not into those chats like spectrum and discord, it's annoying for me to have to check them etc so I'm making this a question for now and see where it goes, hopefully that's okay for everyone else 🙏

Summary

Provide a way for pages to specify separate manifests for each language

Relevant information

That would be one possible solution, maybe a bit verbose/repeating, though you could define your shared base options and then just extend them but it gives a lot of flexibility so people can define different icons, colors etc (proof that icon localization is a thing w3c/manifest#676 (comment))

{
  resolve: `gatsby-plugin-manifest`,
  options: [
    {
      name: `Full name`,
      short_name: `Name`,
      start_url: `/en/?utm_source=a2hs`,
      background_color: `#fff`,
      theme_color: `red`,
      display: `standalone`,
      icon: `static/icon.png`,
      pattern: `^/en/.*$`,
    },
    {
      name: `Vollständiger Name`,
      short_name: `Name`,
      start_url: `/de/?utm_source=a2hs`,
      background_color: `#fff`,
      theme_color: `rebeccapurple`,
      display: `standalone`,
      icon: `static/icon_de.png`,
      pattern: `^/de/.*$`,
    },
  ],
},

I would suggest still allowing a single object in options to not break anything.

I run on a patched version I just threw in my local packages workspace GaiAma/gaiama.org@ae194c2#diff-0cee23a635d1c08646f35342b6dee83f which doesn't seem to work properly right now, but it did work…

Another possibility might be to just specify multiple plugin declarations and "just" add a pattern property or similar like:

{
  resolve: `gatsby-plugin-manifest`,
  options: {
    name: `GaiAma`,
    short_name: `GaiAma`,
    start_url: `/en/?utm_source=a2hs`,
    background_color: `#fff`,
    theme_color: `#287482`,
    display: `standalone`,
    icon: `static/gaiama_pictogram.png`,
    pattern: `^/en/.*$`,
  },
},
{
  resolve: `gatsby-plugin-manifest`,
  options: {
    name: `GaiAma`,
    short_name: `GaiAma`,
    start_url: `/de/?utm_source=a2hs`,
    background_color: `#fff`,
    theme_color: `#287482`,
    display: `standalone`,
    icon: `static/gaiama_pictogram.png`,
    pattern: `^/de/.*$`,
  },
},

So the pattern would specify in gatsby-ssr which to run/include

I'm not sure if the manifests should be then save in the respective language directory all called manifest.webmanifest or put them all in / root and name them differently?

Another question I have is, what about the manual trigger stuff and listening on beforeinstallprompt in chrome https://developers.google.com/web/fundamentals/app-install-banners/#trigger this plugin should probably support it sooner than later right?

Let me know what you think about all this, any suggestions/feedback are really appreciated 🙏
I think I could implement the i18n stuff properly, if it gets accepted and we settled on an implementation as I don't want to keep my local copy up to date.. I might be able to do the trigger stuff, but that could probably enter another PR

@pieh
Copy link
Contributor

pieh commented Dec 3, 2018

The pattern would determine where we point <link rel="manifest">?

I'm not sure if the manifests should be then save in the respective language directory all called manifest.webmanifest or put them all in / root and name them differently?

Easiest to implement is to put them all in / and add some suffixes

@CanRau
Copy link
Contributor Author

CanRau commented Dec 3, 2018

The pattern would determine where we point <link rel="manifest">?

Exactly 👍 I could name it include or maybe pathPattern/pathnamePattern so it's more clear it matches against the pathname?
And in general, is the design okay? Should I prepare a PR? Or should I wait for more comments?
So you prefer the array or the multiple instances version?

Update: just realized that the array version doesn't work like this as pluginOptions is always an object (right?) so either the multi instance version, or a manifests property or something similar, what do you guys prefer?

Update so I fixed my patched version, that's how I did it for now GaiAma/gaiama.org/blob/master/packages/gatsby-plugin-manifest/gatsby-node.js#L86 if pluginOptions.manifests is an array it generates multiple with language suffix otherwise same as before

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 5, 2019
@gatsbot
Copy link

gatsbot bot commented Feb 5, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot
Copy link

gatsbot bot commented Feb 16, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Feb 16, 2019
@CanRau
Copy link
Contributor Author

CanRau commented Apr 11, 2019

@pieh I understand the amount of issues being a lot of work, just trying to figure out if I should abandon this PR and keep my fork or if it's still interesting..

@pieh pieh added type: feature or enhancement and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Apr 11, 2019
@pieh pieh reopened this Apr 11, 2019
@LekoArts
Copy link
Contributor

Did you see these articles? I'm not sure if your current solution is the best one and there is probably the need for more investigation:

https://developer.chrome.com/webstore/i18n
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Internationalization

@CanRau
Copy link
Contributor Author

CanRau commented Apr 24, 2019

No I haven't @LekoArts thanks for bringing them up 🙏
More in #13471

@gatsbot
Copy link

gatsbot bot commented May 15, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label May 15, 2019
@CanRau
Copy link
Contributor Author

CanRau commented May 16, 2019

Thanks for reminding me gatsbot, I think this one can be closed as final discussion happens over at the PR #13471

@CanRau CanRau closed this as completed May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants