Socket
Socket
Sign inDemoInstall

@automattic/i18n-utils

Package Overview
Dependencies
7
Maintainers
50
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @automattic/i18n-utils

WordPress.com i18n utils.


Version published
Maintainers
50
Created

Readme

Source

I18n Utils

I18n-related utilities for use by client, server, apps, and packages.

Usage

import { localizeUrl } from '@automattic/i18n-utils';

Setting up the locale slug

In order to make some i18n utils work in React you need to supply a locale slug to <LocaleProvider> somewhere high up in your react tree. How you get this locale slug will depend on the app @automattic/i18n-utils is being used in.

import { LocaleProvider } from '@automattic/i18n-utils';

function renderApp() {
	return (
		<LocaleProvider localeSlug="en">
			<div>... your app components go here ...</div>
		</LocaleProvider>
	);
}

Once a <LocaleProvider> is available near the root of your tree the useLocale() hook can be used in your components.

FAQs

Last updated on 07 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc