import { Context } from "@nuxt/types";
import { AbstractRegistry } from "~/src/registry";

export class LanguageRegistry extends AbstractRegistry<Language> {

	public constructor(context: Context) {
		super(context);

		this.registerLanguage({
			id: 'en-US',
			name: 'English (United States)',
			dayjs: 'en',
			icon: 'us'
		});

		this.registerLanguage({
			id: 'nl-NL',
			name: 'Dutch',
			dayjs: 'nl',
			icon: 'nl'
		});
	}

	public registerLanguage(language: Language) {
		this.register(language.id, language);
	}

}

/**
 * A single known language locale
 */
export interface Language {
	id: string;
	name: string;
	dayjs: string;
	icon?: string;
}