### File

`packages/base/src/lib/eui-models/eui-language/eui-eu-languages.model.ts`

### Index

###### Methods

- Static filterEULanguages
- Static filterInvalidLanguageCodes
- Static filterNonEULanguages
- Static getAllLanguagesByCodes
- Static getLanguageByCode
- Static getLanguageCodes
- Static getLanguages
- Static getOrderedLanguages
- Static isEuLanguage

### Methods

Static filterEULanguages
`filterEULanguages(array: EuiLanguage[])`

filter EU Languages from given array

Parameters :

Name | Type | Optional | Description
array | `EuiLanguage[]` | No | An array of EuiLanguage items

Returns : `EuiLanguage[]`

Static filterInvalidLanguageCodes
`filterInvalidLanguageCodes(codes: EuiLanguageCode[])`

filters and removes language codes that are not part of the EULanguage e.g. 'ko' does not map to any EULanguage code on the array. { code: 'ko', label: 'whatever' } is valid though

Parameters :

Name | Type | Optional | Description
codes | `EuiLanguageCode[]` | No | codes A string array of 2 char codescodes A string array of 2 char codes

Returns : `EuiLanguageCode[]`

Static filterNonEULanguages
`filterNonEULanguages(array: EuiLanguage[])`

filter non EU languages from given array

Parameters :

Name | Type | Optional | Description
array | `EuiLanguage[]` | No | An array of EuiLanguage items

Returns : `EuiLanguage[]`

Static getAllLanguagesByCodes
`getAllLanguagesByCodes(codes: string[])`

Returns array of EuiLanguage that match the given codes. If codes array is empty, returns all languages.

Parameters :

Name | Type | Optional | Description
codes | `string[]` | No | A string array of 2 char codes, ex. ['en', 'de']

Returns : `EuiLanguage[]`

Static getLanguageByCode
`getLanguageByCode(code: string)`

Parameters :

Name | Type | Optional | Description
code | `string` | No | language code, ex. 'lu'

Returns : `EuiLanguage`

Static getLanguageCodes
`getLanguageCodes(array: EuiLanguageCode[])`

retrieve language codes (string array) from a given array of string and EuiLanguage items

Parameters :

Name | Type | Optional | Description
array | `EuiLanguageCode[]` | No | It can be an mixed array of string and EuiLanguage items

Returns : `string[]`

Static getLanguages
`getLanguages(codes: EuiLanguageCode[])`

Matches the given string array to the EU languages and returns a EuiLanguage array. In case that no codes provided it returns the EU Languages array.

Parameters :

Name | Type | Optional | Default value | Description
codes | `EuiLanguageCode[]` | No | `Object.keys(this.languages)` | A string array of 2 char codes

Returns : `EuiLanguage[]`

Static getOrderedLanguages
`getOrderedLanguages(codes: EuiLanguageCode[])`

return the given list ordered based on the EULanguage order

Parameters :

Name | Type | Optional | Default value | Description
codes | `EuiLanguageCode[]` | No | `Object.keys(this.languages)` | codes A string array of 2 char codes

Returns : `EuiLanguage[]`

Static isEuLanguage
`isEuLanguage(code: string)`

Parameters :

Name | Type | Optional | Description
code | `string` | No | language code, ex. 'lu'

Returns : `boolean`

# results matching ""

# No results matching ""