import 'moment/locale/km';
import 'moment/locale/ga';
import 'moment/locale/sr';
+import 'moment/locale/ko';
import {
UserOperation,
PrivateMessage,
User,
SortType,
- CommentSortType,
ListingType,
- DataType,
SearchType,
WebSocketResponse,
WebSocketJsonResponse,
SearchResponse,
CommentResponse,
PostResponse,
-} from './interfaces';
+} from 'lemmy-js-client';
+
+import { CommentSortType, DataType } from './interfaces';
import { UserService, WebSocketService } from './services';
import Tribute from 'tributejs/src/Tribute.js';
{ code: 'gl', name: 'Galego' },
{ code: 'hu', name: 'Magyar Nyelv' },
{ code: 'ka', name: 'ქართული ენა' },
+ { code: 'ko', name: '한국어' },
{ code: 'km', name: 'ភាសាខ្មែរ' },
{ code: 'hi', name: 'मानक हिन्दी' },
{ code: 'fa', name: 'فارسی' },
}
export function routeSortTypeToEnum(sort: string): SortType {
- if (sort == 'new') {
- return SortType.New;
- } else if (sort == 'hot') {
- return SortType.Hot;
- } else if (sort == 'active') {
- return SortType.Active;
- } else if (sort == 'topday') {
- return SortType.TopDay;
- } else if (sort == 'topweek') {
- return SortType.TopWeek;
- } else if (sort == 'topmonth') {
- return SortType.TopMonth;
- } else if (sort == 'topyear') {
- return SortType.TopYear;
- } else if (sort == 'topall') {
- return SortType.TopAll;
- }
+ return SortType[sort];
}
export function routeListingTypeToEnum(type: string): ListingType {
- return ListingType[capitalizeFirstLetter(type)];
+ return ListingType[type];
}
export function routeDataTypeToEnum(type: string): DataType {
lang = 'ga';
} else if (lang.startsWith('sr')) {
lang = 'sr';
+ } else if (lang.startsWith('ko')) {
+ lang = 'ko';
} else {
lang = 'en';
}
if (text) {
let form: SearchForm = {
q: text,
- type_: SearchType[SearchType.Users],
- sort: SortType[SortType.TopAll],
+ type_: SearchType.Users,
+ sort: SortType.TopAll,
page: 1,
limit: mentionDropdownFetchLimit,
};
if (text) {
let form: SearchForm = {
q: text,
- type_: SearchType[SearchType.Communities],
- sort: SortType[SortType.TopAll],
+ type_: SearchType.Communities,
+ sort: SortType.TopAll,
page: 1,
limit: mentionDropdownFetchLimit,
};
return props.match.params.listing_type
? routeListingTypeToEnum(props.match.params.listing_type)
: UserService.Instance.user
- ? UserService.Instance.user.default_listing_type
+ ? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
: ListingType.All;
}
return props.match.params.sort
? routeSortTypeToEnum(props.match.params.sort)
: UserService.Instance.user
- ? UserService.Instance.user.default_sort_type
+ ? Object.values(SortType)[UserService.Instance.user.default_sort_type]
: SortType.Active;
}