Commit eb87b6b0 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed fetching translations

parent f4c6736d
......@@ -209,14 +209,16 @@ public class ArticleController extends BaseController {
body = doc.body().html();
}
if (targetId != null && classPkShortName != null) {
if (targetId != null && StringUtils.isNotBlank(classPkShortName)) {
ClassPK classPk = contentService.getClassPk(classPkShortName);
contentService.updateArticle(Class.forName(classPk.getClassName()), targetId, slug, title, body, summary, new Locale(lang));
} else {
responses.add("article.translations-updated");
} else if (targetId == null && StringUtils.isBlank(classPkShortName)) {
contentService.updateGlobalArticle(slug, locale, title, body, summary);
responses.add("article.translations-updated");
} else {
responses.add("Error updating local content");
}
responses.add("article.translations-updated");
} catch (IOException e) {
_logger.warn(e.getMessage(), e);
responses.add(e.getMessage());
......@@ -226,8 +228,8 @@ public class ArticleController extends BaseController {
redirectAttrs.addFlashAttribute("responseFromTransifex", responses);
return "redirect:/content/" + (targetId == null ? slug : slug + "/" + classPkShortName + "/" + targetId) + "/"
+ LocaleContextHolder.getLocale().getLanguage();
return "redirect:/content/"
+ (targetId == null ? slug : slug + "/" + classPkShortName + "/" + targetId + "/" + LocaleContextHolder.getLocale().getLanguage());
}
@RequestMapping
......
......@@ -46,17 +46,21 @@ public class SpringProperties {
}
/**
* localeURLFilter in web.xml: en es de fr fa ar ru zh pt
*/
@Bean
public static Set<String> supportedLocales() {
final Set<String> supportedLocales = new HashSet<String>();
supportedLocales.add("en");
supportedLocales.add("ar");
supportedLocales.add("es");
supportedLocales.add("de");
supportedLocales.add("fa");
supportedLocales.add("fr");
supportedLocales.add("pt");
supportedLocales.add("fa");
supportedLocales.add("ar");
supportedLocales.add("ru");
supportedLocales.add("zh");
supportedLocales.add("pt");
return supportedLocales;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment