MCPcopy Create free account
hub / github.com/i18next/react-i18next / getScriptPartFromCode

Method getScriptPartFromCode

react-i18next.js:921–929  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

919 this.logger = baseLogger.create('languageUtils');
920 }
921 getScriptPartFromCode(code) {
922 code = getCleanedCode(code);
923 if (!code || !code.includes('-')) return null;
924 const p = code.split('-');
925 if (p.length === 2) return null;
926 p.pop();
927 if (p[p.length - 1].toLowerCase() === 'x') return null;
928 return this.formatLanguageCode(p.join('-'));
929 }
930 getLanguagePartFromCode(code) {
931 code = getCleanedCode(code);
932 if (!code || !code.includes('-')) return code;

Callers 3

getBestMatchFromCodesMethod · 0.95
getFallbackCodesMethod · 0.95
toResolveHierarchyMethod · 0.95

Calls 2

formatLanguageCodeMethod · 0.95
getCleanedCodeFunction · 0.85

Tested by

no test coverage detected