Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
fetch supported locales only once instead of three times (#2276)
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
  • Loading branch information
maggu2810 authored and kaikreuzer committed Oct 7, 2016
1 parent 354ed5c commit 6e3d779
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

import org.eclipse.smarthome.core.voice.text.HumanLanguageInterpreter;

Expand All @@ -32,10 +33,11 @@ public static HumanLanguageInterpreterDTO map(HumanLanguageInterpreter hli, Loca
HumanLanguageInterpreterDTO dto = new HumanLanguageInterpreterDTO();
dto.id = hli.getId();
dto.label = hli.getLabel(locale);
if (hli.getSupportedLocales() != null) {
dto.locales = new HashSet<String>(hli.getSupportedLocales().size());
for (Locale l : hli.getSupportedLocales()) {
dto.locales.add(l.toString());
final Set<Locale> supportedLocales = hli.getSupportedLocales();
if (supportedLocales != null) {
dto.locales = new HashSet<String>(supportedLocales.size());
for (final Locale supportedLocale : supportedLocales) {
dto.locales.add(supportedLocale.toString());
}
}
return dto;
Expand Down

0 comments on commit 6e3d779

Please sign in to comment.