The LanguageCode
Search Criterion
searches for content based on whether it is translated into the selected language.
value
- string(s) representing the language codes to search for- (optional)
matchAlwaysAvailable
- bool representing whether content with thealwaysAvailable
flag should be returned even if it does not contain the selected language (defaulttrue
)
$query->query = new Criterion\LanguageCode('ger-DE', false);
=== "XML"
```xml
<Query>
<Filter>
<LanguageCodeCriterion>eng-GB</LanguageCodeCriterion>
</Filter>
</Query>
```
=== "JSON"
```json
"Query": {
"Filter": {
"LanguageCodeCriterion": "eng-GB"
}
}
```
You can use the LanguageCode
Criterion to search for articles that are lacking a translation
into a specific language:
[[= include_file('code_samples/search/language/src/Controller/ArticlesToTranslateController.php', 24, 41) =]]
You can use the LanguageCode
Criterion to search in
several languages while ensuring results have a translation in one specific language:
[[= include_file('code_samples/search/language/src/Command/SearchTestCommand.php', 35, 47) =]]