npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kuus/gatsby-plugin-i18n

v0.7.7

Published

This plugin is meant to be used with netlify and its [gatsby-plugin-netlify](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-netlify) to correctly handle redirects server side. A less SEO friendly alternative would be to use this plu

Downloads

17

Readme

Gatsby plugin i18n

This plugin is meant to be used with netlify and its gatsby-plugin-netlify to correctly handle redirects server side. A less SEO friendly alternative would be to use this plugin alongside gatsby-plugin-meta-redirect or gatsby-plugin-client-side-redirect, they all exploit the gatsby's createRedirect action.

Localised messages

  • Components specific string are prefixed by the component name in PascalCase, e.g. for component Header the string prefix is Header.
  • Pages and templates specific strings are prefixed by the page component name all lowercase minus the prefix Pages or Template, e.g. for page about the component would be PagesAbout and the string prefix is about., for the template blog-single the component would be TemplateBlogSingle and the string prefix is blogsingle
  • Generic strings not tight to any component or page in particular are prefxed with a . dot and begin lowercase, e.g. .globalMessage

Known issues

  • Gatsby generates a warning like:
warn There are routes that match both page and redirect.
It will result in page not being accessible; this is
probably not intentional:
 - page: "/" and redirect: "/" -> "/it/"

That is fine as the redirect is created with the Language Netlify's specific option for createRedirect and therefore the warning message is misleading as it does not take into account the language based redirect.

  • Gatsby's warnings:
warn Plugin `@kuus/gatsby-plugin-i18n` has customized the
 built-in Gatsby GraphQL type `File`. This is allowed,
but could potentially cause conflicts.
warn Plugin `gatsby-plugin-mdx` has customized the
GraphQL type `Mdx`, which has already been defined by the
 plugin `@kuus/gatsby-plugin-i18n`. This could
potentially cause conflicts.

are fine... We need to customise those Node's types to have a seamless localization API.

Resources

Similar projects

There are many on npm.

Issues

Language based redirects

Those that use Language: locale in the createRedirect method, they seem to do not work at the moment, see this issue or this one for instance.

Trailing slashes

Netlify when loading a page directly or refreshing the browser when you are on a page without a trailing slash it will redirect to the same url with a trailing slash, this happens even with Pretty URLS setting disabled on Netlify panel. See this issue. Until this issue with netlify is not solved we set by default trailing slashed on all paths with the util normaliseUrlPath.

Custom slugs

TODO: