import i18n from 'i18next';

/**
 * Translate a server-derived value (feature name, enum value, group name, etc.).
 * Looks up `server.${value}` in the current locale. Falls back to the original
 * English string if no translation exists, so unknown values are safe.
 */
export function ts(value: string): string {
  const key = `server.${value}`;
  const result = i18n.t(key, { defaultValue: value });
  return typeof result === 'string' ? result : value;
}

// Re-export tsDesc and tsDetail from descriptions.ts for convenience
export { tsDesc, tsDetail } from './descriptions';
