Developer Experience

YAML8n gives your developers a great experience by creating translations automatically while they’re developing.

YAML8n can watch, check, and generate translations on save:

$ cat package/yaml8n.ts
/* eslint-disable */

// Code generated by YAML8n; DO NOT EDIT.

export type ISO639Code = string;

export interface Translation {
        [key: ISO639Code]: string,
}

export const ISO639Codes: {
        [key: ISO639Code]: string,
} = {
        ar: "عربي",
        de: "Deutsch",
        en: "English",
        es: "Español",
        fr: "Francais",
        hi: "हिन्दी",
        nl: "Nederlands",
        zh: "中文",
};

export function Translate (c: ISO639Code, t: Translation): string {
        const code = c.split("-")[0];
        if (t[code] !== undefined) {
                return t[code];
        }

        return t["en"];
}
$ ./yaml8n watch translations.yaml &
$ vi translations.yaml
[NOTICE]
5 Warnings Found:
- ActionAdd is missing a translation: es
- ActionAdd is missing a translation: fr
- ActionAdd is missing a translation: hi
- ActionAdd is missing a translation: nl
- ActionAdd is missing a translation: zh
$ cat translations.yaml
/* eslint-disable */

// Code generated by YAML8n and covered under the
// Candid Public License; DO NOT EDIT.

export type ISO639Code = string;

export interface Translation {
        [key: ISO639Code]: string,
}

export const ISO639Codes: {
        [key: ISO639Code]: string,
} = {
        ar: "عربي",
        de: "Deutsch",
        en: "English",
        es: "Español",
        fr: "Francais",
        hi: "हिन्दी",
        nl: "Nederlands",
        zh: "中文",
};

export function Translate (c: ISO639Code, t: Translation): string {
        const code = c.split("-")[0];
        if (t[code] !== undefined) {
                return t[code];
        }

        return t["en"];
}

export const ActionAdd: Translation = {
        ar: `يضيف`,
        de: `Hinzufügen`,
        en: `Add`,
};