Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Improved Translation API via Hooks #645

Open
ganemone opened this issue Dec 5, 2018 · 1 comment
Open

Improved Translation API via Hooks #645

ganemone opened this issue Dec 5, 2018 · 1 comment
Labels

Comments

@ganemone
Copy link
Contributor

ganemone commented Dec 5, 2018

We should investigate if we can improve our translations API using hooks.

Type of issue

Feature Request

Description

The current API for working with raw translated strings is a bit cumbersome, as it requires duplicating the translation keys, once in the withTranslations call, and once in the translate call. This is further described here: #643

We should investigate various options of improving this API, potentially taking advantage of hooks.

@ganemone
Copy link
Contributor Author

ganemone commented Dec 5, 2018

A potential hook API could look something like this:

import {useTranslate} from 'fusion-plugin-i18n-react';

function Component() {
  const translate = useTranslate();
  const value = translate('some.key');
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant