Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ export type SourceLanguageCode = CommonLanguageCode | 'en' | 'pt';
* Note: although the language code type definitions are case-sensitive, this package and the DeepL
* API accept case-insensitive language codes.
*/
export type TargetLanguageCode = CommonLanguageCode | 'en-GB' | 'en-US' | 'pt-BR' | 'pt-PT';
export type TargetLanguageCode =
| CommonLanguageCode
| 'en-GB'
| 'en-US'
| 'pt-BR'
| 'pt-PT'
| 'zh-HANS'
| 'zh-HANT';

/**
* All language codes, including source-only and target-only language codes.
Expand Down
4 changes: 4 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ export function buildURLSearchParams(
throw new DeepLError(
"targetLang='pt' is deprecated, please use 'pt-PT' or 'pt-BR' instead.",
);
} else if (targetLang === 'zh') {
throw new DeepLError(
"targetLang='zh' is deprecated, please use 'zh-HANS' or 'zh-HANT' instead.",
);
Comment on lines +170 to +173
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we noticed that this is a breaking change (which would not be allowed the next minor version). We will be undoing this part of the MR before the next release.

}

const searchParams = new URLSearchParams({
Expand Down
2 changes: 2 additions & 0 deletions tests/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const internalExampleText: Record<string, string> = {
tr: 'proton ışını',
uk: 'протонний пучок',
zh: '质子束',
'zh-HANS': '质子束',
'zh-HANT': '質子束',
};

export const usingMockServer = process.env.DEEPL_MOCK_SERVER_PORT !== undefined;
Expand Down