]> Untitled Git - lemmy.git/blobdiff - ui/src/utils.ts
Updating code url references to https://github.com/LemmyNet/lemmy
[lemmy.git] / ui / src / utils.ts
index 48bd175e25a5d2933ef5db27804df5b61a161ee9..ceb05764d27e389f3047a34f62987f21cdef11f6 100644 (file)
@@ -12,6 +12,7 @@ import 'moment/locale/ca';
 import 'moment/locale/fa';
 import 'moment/locale/pt-br';
 import 'moment/locale/ja';
+import 'moment/locale/ka';
 
 import {
   UserOperation,
@@ -43,7 +44,7 @@ import emojiShortName from 'emoji-short-name';
 import Toastify from 'toastify-js';
 import tippy from 'tippy.js';
 
-export const repoUrl = 'https://github.com/dessalines/lemmy';
+export const repoUrl = 'https://github.com/LemmyNet/lemmy';
 export const helpGuideUrl = '/docs/about_guide.html';
 export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`;
 export const sortingHelpUrl = `${helpGuideUrl}#sorting`;
@@ -59,6 +60,7 @@ export const languages = [
   { code: 'eo', name: 'Esperanto' },
   { code: 'es', name: 'Español' },
   { code: 'de', name: 'Deutsch' },
+  { code: 'ka', name: 'ქართული ენა' },
   { code: 'fa', name: 'فارسی' },
   { code: 'ja', name: '日本語' },
   { code: 'pt_BR', name: 'Português Brasileiro' },
@@ -353,6 +355,8 @@ export function getMomentLanguage(): string {
     lang = 'pt-br';
   } else if (lang.startsWith('ja')) {
     lang = 'ja';
+  } else if (lang.startsWith('ka')) {
+    lang = 'ka';
   } else {
     lang = 'en';
   }
@@ -819,3 +823,11 @@ function hsl(num: number) {
 function randomHsl() {
   return `hsla(${Math.random() * 360}, 100%, 50%, 1)`;
 }
+
+export function previewLines(text: string, lines: number = 3): string {
+  // Use lines * 2 because markdown requires 2 lines
+  return text
+    .split('\n')
+    .slice(0, lines * 2)
+    .join('\n');
+}