mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'ditto-lang' into 'main'
Make @ditto/lang its own package See merge request soapbox-pub/ditto!672
This commit is contained in:
commit
8b768620bc
5 changed files with 11 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
"./packages/conf",
|
||||
"./packages/db",
|
||||
"./packages/ditto",
|
||||
"./packages/lang",
|
||||
"./packages/metrics",
|
||||
"./packages/uploaders"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// deno-lint-ignore-file require-await
|
||||
|
||||
import { DittoTables } from '@ditto/db';
|
||||
import { detectLanguage } from '@ditto/lang';
|
||||
import { NPostgres, NPostgresSchema } from '@nostrify/db';
|
||||
import { dbEventsCounter } from '@ditto/metrics';
|
||||
import { NIP50, NKinds, NostrEvent, NostrFilter, NSchema as n } from '@nostrify/nostrify';
|
||||
|
|
@ -18,7 +19,6 @@ import { isNostrId } from '@/utils.ts';
|
|||
import { abortError } from '@/utils/abort.ts';
|
||||
import { purifyEvent } from '@/utils/purify.ts';
|
||||
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||
import { detectLanguage } from '@/utils/language.ts';
|
||||
import { getMediaLinks } from '@/utils/note.ts';
|
||||
|
||||
/** Function to decide whether or not to index a tag. */
|
||||
|
|
|
|||
7
packages/lang/deno.json
Normal file
7
packages/lang/deno.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "@ditto/lang",
|
||||
"version": "1.1.0",
|
||||
"exports": {
|
||||
".": "./language.ts"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { detectLanguage } from '@/utils/language.ts';
|
||||
import { assertEquals } from '@std/assert';
|
||||
|
||||
import { detectLanguage } from './language.ts';
|
||||
|
||||
Deno.test('Detect English language', () => {
|
||||
assertEquals(detectLanguage(``, 0.90), undefined);
|
||||
assertEquals(detectLanguage(`Good morning my fellow friends`, 0.90), 'en');
|
||||
Loading…
Add table
Reference in a new issue