-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: display the language name instead of the label
- Loading branch information
Showing
10 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { iso6391X } from '@kabeep/node-translate'; | ||
|
||
function getNativeName(code?: string) { | ||
return iso6391X.getNativeName(code || ''); | ||
} | ||
|
||
export default getNativeName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export { default as catcher } from './catcher.js'; | ||
export { default as getColumns } from './get-columns.js'; | ||
export { default as getLanguageName } from './get-language-name.js'; | ||
export { default as getNativeName } from './get-native-name.js'; | ||
export { default as isError } from './is-error.js'; | ||
export { Info, Success, Warning, Failure } from './notify.js'; | ||
export { Translation, Source, Synonym, Polysemy, Sentence, Language, Adaptive, Code } from './typography.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { expect, test } from 'vitest'; | ||
import getNativeName from '../../src/utils/get-native-name'; | ||
|
||
test('getNativeName - should return empty string when code is undefined', () => { | ||
const result = getNativeName(); | ||
expect(result).toBe(''); | ||
}); | ||
|
||
test('getNativeName - should return empty string when code is invalid', () => { | ||
const result = getNativeName('auto'); | ||
expect(result).toBe(''); | ||
}); | ||
|
||
test('getNativeName - should return the native name when code is provided', () => { | ||
const result = getNativeName('zh-CN'); | ||
expect(result).toBe('简体中文'); | ||
}); |