mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
i18n implementation (#55)
This commit is contained in:
@@ -26,6 +26,7 @@ import org.apache.wicket.request.cycle.RequestCycle;
|
||||
import org.apache.wicket.util.crypt.Base64;
|
||||
|
||||
import com.commafeed.backend.MetricsBean;
|
||||
import com.commafeed.backend.StartupBean;
|
||||
import com.commafeed.backend.dao.FeedCategoryDAO;
|
||||
import com.commafeed.backend.dao.FeedDAO;
|
||||
import com.commafeed.backend.dao.FeedEntryDAO;
|
||||
@@ -89,6 +90,9 @@ public abstract class AbstractREST {
|
||||
@Inject
|
||||
UserService userService;
|
||||
|
||||
@Inject
|
||||
StartupBean startupBean;
|
||||
|
||||
@Inject
|
||||
UserSettingsDAO userSettingsDAO;
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ public class ServerREST extends AbstractResourceREST {
|
||||
ServerInfo infos = new ServerInfo();
|
||||
infos.setAnnouncement(applicationSettingsService.get()
|
||||
.getAnnouncement());
|
||||
infos.getSupportedLanguages().putAll(
|
||||
startupBean.getSupportedLanguages());
|
||||
return infos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ public class UserREST extends AbstractResourceREST {
|
||||
public Response saveSettings(@ApiParam Settings settings) {
|
||||
Preconditions.checkNotNull(settings);
|
||||
|
||||
if (startupBean.getSupportedLanguages().get(settings.getLanguage()) == null) {
|
||||
settings.setLanguage("en");
|
||||
}
|
||||
|
||||
UserSettings s = userSettingsDAO.findByUser(getUser());
|
||||
if (s == null) {
|
||||
s = new UserSettings();
|
||||
|
||||
Reference in New Issue
Block a user