All files / packages/i18n/src/core translationsKey.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9        57x   4x 19x  
import { hash } from "ohash";
import type { Locale } from "./domain/translations";
import type { VendorConfig } from "./registry";
 
const toWordChars = (part: string): string => part.replaceAll("_", "_u").replaceAll("-", "_d");
 
export const translationsKey = (vendor: VendorConfig, locale: Locale): string =>
    [vendor.name, locale, hash({ ...vendor, options: undefined })].map(toWordChars).join("_");