Unverified Commit 8e3cd83d authored by Darshan Jain's avatar Darshan Jain Committed by GitHub

Allow general language codes in the Metadata API (#52920)

Closes #52898

LangCode Missing zh-Hans and zh-Hant

| 'yo-NG'
  | 'zh-CN'
  | 'zh-Hans'   //added
  | 'zh-Hant'        //added
  | 'zh-HK'
  | 'zh-MO'
  | 'zh-SG'
  | 'zh-TW'
  | 'zu-ZA'


https://github.com/vercel/next.js/blob/f5272acbe5628164257ef8e584c8a469a4af5cb8/packages/next/src/lib/metadata/types/alternative-urls-types.ts#L419Co-authored-by: 's avatarShu Ding <3676859+shuding@users.noreply.github.com>
parent df0330f7
...@@ -66,7 +66,10 @@ export const resolveViewport: FieldResolver<'viewport'> = (viewport) => { ...@@ -66,7 +66,10 @@ export const resolveViewport: FieldResolver<'viewport'> = (viewport) => {
function resolveUrlValuesOfObject( function resolveUrlValuesOfObject(
obj: obj:
| Record<string, string | URL | AlternateLinkDescriptor[] | null> | Record<
string,
string | URL | AlternateLinkDescriptor[] | null | undefined
>
| null | null
| undefined, | undefined,
metadataBase: ResolvedMetadata['metadataBase'], metadataBase: ResolvedMetadata['metadataBase'],
......
...@@ -412,7 +412,15 @@ type LangCode = ...@@ -412,7 +412,15 @@ type LangCode =
| 'zh-MO' | 'zh-MO'
| 'zh-SG' | 'zh-SG'
| 'zh-TW' | 'zh-TW'
| 'zh-Hans'
| 'zh-Hant'
| 'zu-ZA' | 'zu-ZA'
// We can't have all valid combinations of language-region-script listed here
// as the list is too long and breaks the TypeScript compiler. So instead we
// only add the most common ones with a general string pattern for the rest.
// This way autocompletion still works and it is still possible to add custom
// lang codes.
| `${Lowercase<string>}-${string}`
type UnmatchedLang = 'x-default' type UnmatchedLang = 'x-default'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment