Skip to content

Commit

Permalink
Task-65373: Language version option
Browse files Browse the repository at this point in the history
Task-65423: Add a language
  • Loading branch information
mkrout committed Aug 30, 2023
1 parent f8cc717 commit 4e80b88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1362,14 +1362,17 @@ public Response searchData(@Context
public Response getAvailableLanguages(@Context
UriInfo uriInfos,
@QueryParam("lang") String lang
) throws Exception {
) {
try {
Set<Locale> locales = LocaleContextInfoUtils.getSupportedLocales();
List<Locale> localesList = new ArrayList(locales);
List<Locale> localesList = new ArrayList<>(locales);
JSONArray localesJSON = new JSONArray();
Locale currentLocal= Locale.ENGLISH;
if (!lang.isEmpty()){
currentLocal = Arrays.stream(Locale.getAvailableLocales()).filter(local -> local.getLanguage().equals(lang)).findAny().get();
Optional<Locale> opLocal = Arrays.stream(Locale.getAvailableLocales()).filter(local -> local.getLanguage().equals(lang)).findAny();
if (opLocal.isPresent()) {
currentLocal = opLocal.get();
}
}
for (Locale locale : localesList) {
JSONObject object = new JSONObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function getNoteById(noteId,lang,source,type,owner,withChildren) {
url=`${url}${getSeparator(url)}noteBookOwner=${owner}`;
} if (withChildren){
url=`${url}${getSeparator(url)}withChildren=${withChildren}`;
}if (lang){
} if (lang){
url=`${url}${getSeparator(url)}lang=${lang}`;
}
return fetch(url, {
Expand Down

0 comments on commit 4e80b88

Please sign in to comment.