mirror of https://github.com/halo-dev/halo
Revert
parent
5c1b521b11
commit
eeb06ca9bb
|
@ -91,7 +91,7 @@ public class LocalFileHandler implements FileHandler {
|
||||||
Assert.notNull(file, "Multipart file must not be null");
|
Assert.notNull(file, "Multipart file must not be null");
|
||||||
|
|
||||||
// Get current time
|
// Get current time
|
||||||
Calendar current = Calendar.getInstance(Locale.CHINESE);
|
Calendar current = Calendar.getInstance(optionService.getLocale());
|
||||||
// Get month and day of month
|
// Get month and day of month
|
||||||
int year = current.get(Calendar.YEAR);
|
int year = current.get(Calendar.YEAR);
|
||||||
int month = current.get(Calendar.MONTH) + 1;
|
int month = current.get(Calendar.MONTH) + 1;
|
||||||
|
|
|
@ -6,6 +6,11 @@ package run.halo.app.model.properties;
|
||||||
*/
|
*/
|
||||||
public enum BlogProperties implements PropertyEnum {
|
public enum BlogProperties implements PropertyEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blog locale.
|
||||||
|
*/
|
||||||
|
BLOG_LOCALE("blog_locale", String.class),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blog title.
|
* Blog title.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -268,4 +268,12 @@ public interface OptionService extends CrudService<Option, Integer> {
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
Zone getQnYunZone();
|
Zone getQnYunZone();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets locale.
|
||||||
|
*
|
||||||
|
* @return locale user set or default locale
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
Locale getLocale();
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,4 +269,15 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
|
||||||
|
|
||||||
}).orElseGet(Zone::autoZone);
|
}).orElseGet(Zone::autoZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Locale getLocale() {
|
||||||
|
return getByProperty(BlogProperties.BLOG_LOCALE).map(localeStr -> {
|
||||||
|
try {
|
||||||
|
return Locale.forLanguageTag(localeStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Locale.getDefault();
|
||||||
|
}
|
||||||
|
}).orElseGet(Locale::getDefault);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,7 @@ public class InstallController {
|
||||||
// Init default properties
|
// Init default properties
|
||||||
Map<PropertyEnum, String> properties = new HashMap<>(11);
|
Map<PropertyEnum, String> properties = new HashMap<>(11);
|
||||||
properties.put(PrimaryProperties.IS_INSTALLED, Boolean.TRUE.toString());
|
properties.put(PrimaryProperties.IS_INSTALLED, Boolean.TRUE.toString());
|
||||||
|
properties.put(BlogProperties.BLOG_LOCALE, installParam.getLocale());
|
||||||
properties.put(BlogProperties.BLOG_TITLE, installParam.getTitle());
|
properties.put(BlogProperties.BLOG_TITLE, installParam.getTitle());
|
||||||
properties.put(BlogProperties.BLOG_URL, installParam.getUrl());
|
properties.put(BlogProperties.BLOG_URL, installParam.getUrl());
|
||||||
properties.put(PrimaryProperties.THEME, DEFAULT_THEME_NAME);
|
properties.put(PrimaryProperties.THEME, DEFAULT_THEME_NAME);
|
||||||
|
|
Loading…
Reference in New Issue