export const languageLimitData: Record<string, languageLimit> = {
  '^UI_MergeData_(\\d+)$': { zh_CN: 20, latin:20 },
  'UI_MainLevelPanel_title': { zh_CN:16, latin: 16 },
}

export interface languageLimit{
    key?: string;
    zh_CN?: number;
    latin?: number;
}

/**
 * 计算字符串长度：中文字符按 2 计，其它字符按 1 计。
 */
export function getWeightedTextLength(text: string): number {
  if (!text) {
    return 0;
  }

  let length = 0;
  for (const ch of text) {
    length += /[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]/.test(ch) ? 2 : 1;
  }

  return length;
}