npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

raycast-language-detector

v0.2.4

Published

Detect languages through Raycast AI or third-party language detectors

Downloads

46

Readme

raycast-language-detector

Detect languages through Raycast AI or third-party language detectors

Install

npm i raycast-language-detector

Usages

import { detect } from "raycast-language-detector";
import { detect as aiDetect } from "raycast-language-detector/ai";
import { detect as francDetect } from "raycast-language-detector/franc";
import { detect as langDetect } from "raycast-language-detector/languagedetect";
import { detect as tinyDetect } from "raycast-language-detector/tinyld";

await detect("Favourite colour");
//=> {languageCode: 'en_GB', languageName: 'British English'}

await aiDetect("New Level Unlocked");
//=> {languageCode: 'en', languageName: 'English'}

francDetect("여기서요?");
//=> {languageCode: 'ko', languageName: 'Korean'}

langDetect("海纳百川,有容乃大");
//=> {languageCode: 'zh', languageName: 'Chinese'}

tinyDetect("一緒に泣いてくれた人");
//=> {languageCode: 'jp', languageName: 'Japanese'}

API

raycast-language-detector

This uses all possible detectors in the Detector.AI, Detector.Franc, Detector.LanguageDetect, Detector.TinyLD order. It there is no result, it will fallback to the next detector.

The fallthrough order of detectors can be customized, you can simply pass in an array of Detector to options.detectors.

You can also specify the format of language code, possible values are LanguageCodeFormat.ISO_639_1, LanguageCodeFormat.ISO_639_2, and LanguageCodeFormat.ISO_639_3.

export declare const detect: (
	text: string,
	options?: {
		detectors?: Detector[];
		languageCodeFormat?: LanguageCodeFormat;
		aiDetectOptions?: {
			aiAskOptions?: AI.AskOptions;
			languageCodes?: string[];
			languageCodeFormat?: LanguageCodeFormat;
		};
	},
) => Promise<Language | undefined>;
import { detect } from "raycast-language-detector";

await detect("Viel Glück");
//=> {languageCode: 'de_DE', languageName: 'German (Germany)'}

raycast-language-detector/ai

This uses the Raycast AI for detecting text.

You don't have to check user's permission to Raycast AI before using this. We already handled it for you. It will return a undefined if the user doesn't have access to Raycast AI.

export declare const makePrompt: (
	text: string,
	languageCodes?: string[],
) => string;

export declare const detect: (
	text: string,
	options?: {
		aiAskOptions?: AI.AskOptions;
		languageCodes?: string[];
		languageCodeFormat?: LanguageCodeFormat;
	},
) => Promise<Language | undefined>;

export declare const customPromptDetect: (
	prompt: string,
	options?: { aiAskOptions?: AI.AskOptions },
) => Promise<Language | undefined>;
import { detect, customPromptDetect } from "raycast-language-detector/ai";

await detect("colour", { languageCodes: ["en_US", "en_GB"] });
//=> {languageCode: 'en_GB', languageName: 'British English'}

// Create a custom prompt which detects `en_US` and `en_GB` only
const customPrompt = makePrompt("pieapple pizza", ["en_US", "en_GB"]);

await customPromptDetect(customPrompt);
//=> {languageCode: 'en_US', languageName: 'American English'}

raycast-language-detector/franc

This uses the franc for detecting text.

export declare const detect: (
	text: string,
	options?: {
		languageCodeFormat?: LanguageCodeFormat;
	},
) => Language | undefined;
import { detect } from "raycast-language-detect/franc";

detect("여기서요?");
//=> {languageCode: 'ko', languageName: 'Korean'}

raycast-language-detector/languagedetect

This uses the languagedetect for detecting text.

export declare const detect: (
	text: string,
	options?: {
		languageCodeFormat?: LanguageCodeFormat;
	},
) => Language | undefined;
import { detect } from "raycast-language-detector/languagedetector";

detect("海纳百川,有容乃大");
//=> {languageCode: 'zh', languageName: 'Chinese'}

raycast-language-detector/tinyld

This uses the tinyld for detecting text.

export declare const detect: (
	text: string,
	options?: {
		languageCodeFormat: LanguageCodeFormat;
	},
) => Language | undefined;
import { detect } from "raycast-language-detector/tinyld";

detect("一緒に泣いてくれた人");
//=> {languageCode: 'jp', languageName: 'Japanese'}

raycast-language-detector/utils

It exposes some useful utilities for detecting languages.

languageCodeToName(languageCode: string): string

It uses JavaScript built-in Intl.DisplayNames for converting language code to the name.

The input value can be a languageCode ["-" scriptCode] ["-" regionCode ] *("-" variant ) subsequence of the unicode_language_id grammar in UTS 35's Unicode Language and Locale Identifiers grammar. languageCode is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.

import { languageCodeToName } from "raycast-language-detector/utils";

languageCodeToName("en");
//=> 'English'

languageCodeToName("eng");
//=> 'English'

languageCodeToName("en_US");
//=> 'American English'

languageCodeToName("en_GB");
//=> 'British English'

Who's using raycast-langauge-detector?

  • Easy OCR - Use Tesseract OCR to extract text from screenshot
  • Language Detector - Detect languages through Raycast AI or third-party language detectors

License

MIT