import { interpolate, resolveKeyPath } from '@gmp/utils';

import { resources } from './text-resources';

type TOptions = Record<string, unknown>;

const i18n = { language: 'id' as const };

export function useAppText() {
    const t = (key: string, options?: TOptions): string => {
        const template = resolveKeyPath(resources.id, key) ?? key;

        return interpolate(template, options);
    };

    return { t, i18n };
}
