mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
Finally figured out a way to make typescript strongly type translation keys so we can avoid the tedium of creating enums of translation keys.
13 lines
417 B
TypeScript
13 lines
417 B
TypeScript
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2022 The Pybricks Authors
|
|
|
|
import { useI18n as useShopifyI18n } from '@shopify/react-i18n';
|
|
import type { TypedI18n } from '../i18n';
|
|
import type translations from './translations/en.json';
|
|
|
|
export function useI18n(): TypedI18n<typeof translations> {
|
|
// istanbul ignore next: babel-loader rewrites this line
|
|
const [i18n] = useShopifyI18n();
|
|
return i18n;
|
|
}
|