From 78919d3a68aef40ce2f5981dfd13d0e41b71ea47 Mon Sep 17 00:00:00 2001 From: Faruk Nasir Date: Fri, 25 Jun 2021 15:41:12 +0100 Subject: [PATCH] chore: added hausa, yoruba and igbo translations --- src/locales.js | 8 +- src/locales/ha.js | 233 +++++++++++++++++++++++++++++++++++++++++++++ src/locales/ig.js | 234 ++++++++++++++++++++++++++++++++++++++++++++++ src/locales/yo.js | 234 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 708 insertions(+), 1 deletion(-) create mode 100644 src/locales/ha.js create mode 100644 src/locales/ig.js create mode 100644 src/locales/yo.js diff --git a/src/locales.js b/src/locales.js index bee9932..18e7c24 100644 --- a/src/locales.js +++ b/src/locales.js @@ -19,10 +19,14 @@ import es from './locales/es' import fr from './locales/fr' +import ha from './locales/ha' + import he from './locales/he' import hu from './locales/hu' +import ig from './locales/ig' + import it from './locales/it' import ja from './locales/ja' @@ -53,9 +57,11 @@ import tr from './locales/tr' import vi from './locales/vi' +import yo from './locales/yo' + import zh from './locales/zh' /** * ✏️ Then add it to the list here: */ -export { ar, ca, cs, da, de, en, es, fr, he, hu, it, ja, ko, nb, nl, lt, ru, pl, pt, sk, sr, sv, th, tr, vi, zh } +export { ar, ca, cs, da, de, en, es, fr, ha, he, hu, ig, it, ja, ko, nb, nl, lt, ru, pl, pt, sk, sr, sv, th, tr, vi, yo, zh } diff --git a/src/locales/ha.js b/src/locales/ha.js new file mode 100644 index 0000000..66c5c41 --- /dev/null +++ b/src/locales/ha.js @@ -0,0 +1,233 @@ +/** + * Here we can import additional helper functions to assist in formatting our + * language. Feel free to add additional helper methods to libs/formats if it + * assists in creating good validation messages for your locale. + */ +import { sentence as s } from '../libs/formats' + +/** + * This is the ISO 639-1 and (optionally) ISO 639-2 language "tag". + * Some valid examples: + * zh + * zh-CN + * zh-HK + * en + * en-GB + */ +const locale = 'ha' + +/** + * This is an object of functions that each produce valid responses. There's no + * need for these to be 1-1 with english, feel free to change the wording or + * use/not use any of the variables available in the object or the + * arguments for the message to make the most sense in your language and culture. + * + * The validation context object includes the following properties: + * { + * args // Array of rule arguments: between:5,10 (args are ['5', '10']) + * name: // The validation name to be used + * value: // The value of the field (do not mutate!), + * vm: the // FormulateInput instance this belongs to, + * formValues: // If wrapped in a FormulateForm, the value of other form fields. + * } + */ +const localizedValidationMessages = { + + /** + * Valid accepted value. + */ + accepted: function ({ name }) { + return `Da fatan za a karɓa ${name}.` + }, + + /** + * The date is not after. + */ + after: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `dole ne ${s(name)} ya kasance bayan ${args[0]}.` + } + return `${s(name)} dole ne ya zama kwanan wata a nan gaba.` + }, + + /** + * The value is not a letter. + */ + alpha: function ({ name }) { + return `${s(name)} kan iya ƙunsar haruffa kawai.` + }, + + /** + * Rule: checks if the value is alpha numeric + */ + alphanumeric: function ({ name }) { + return `${s(name)} kan iya ƙunsar haruffa da lamba kawai.` + }, + + /** + * The date is not before. + */ + before: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `dole ne ${s(name)} ya kasance kafin ${args[0]}.` + } + return `${s(name)} dole ne ya zama kwanan wata na baya.` + }, + + /** + * The value is not between two numbers or lengths + */ + between: function ({ name, value, args }) { + const force = Array.isArray(args) && args[2] ? args[2] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `dole ne ${s(name)} ya kasance tsakanin ${args[0]} da ${args[1]}.` + } + return `dole ne tsawon haruffan ${s(name)} ya kasance tsakanin ${args[0]} da ${args[1]}.` + }, + + /** + * The confirmation field does not match + */ + confirm: function ({ name, args }) { + return `${s(name)} bai daidaita ba.` + }, + + /** + * Is not a valid date. + */ + date: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} ba ingantaccen kwanan wata bane, da fatan za ayi amfani da tsari ${args[0]}` + } + return `${s(name)} ba ingantaccen kwanan wata bane.` + }, + + /** + * The default render method for error messages. + */ + default: function ({ name }) { + return `Wannan filin bashi da inganci.` + }, + + /** + * Is not a valid email address. + */ + email: function ({ name, value }) { + if (!value) { + return 'A shigar da adireshin i-mel mai inganci.' + } + return `“${value}” ba adireshin imel bane mai inganci.` + }, + + /** + * Ends with specified value + */ + endsWith: function ({ name, value }) { + if (!value) { + return `Wannan filin bai ƙare da adadi mai inganci ba.` + } + return `“${value}” bai ƙare da adadi mai inganci ba.` + }, + + /** + * Value is an allowed value. + */ + in: function ({ name, value }) { + if (typeof value === 'string' && value) { + return `“${s(value)}” ba ${name} mai amsuwa bane.` + } + return `Ba ${name} mai amsuwa bane.` + }, + + /** + * Value is not a match. + */ + matches: function ({ name }) { + return `${s(name)} ba adadi mai amsuwa bane.` + }, + + /** + * The maximum value allowed. + */ + max: function ({ name, value, args }) { + if (Array.isArray(value)) { + return `Za ku iya zabar ${args[0]} ${name} kawai.` + } + const force = Array.isArray(args) && args[1] ? args[1] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} must be less than or equal to ${args[0]}.` + } + return `dole ne ${s(name)} ya zama ƙasa da ko daidai da ${args[0]}.` + }, + + /** + * The (field-level) error message for mime errors. + */ + mime: function ({ name, args }) { + return `Dole ne ${s(name)} ya kasance daga nau'in: ${args[0] || 'Babu izinin tsarin fayil.'}` + }, + + /** + * The maximum value allowed. + */ + min: function ({ name, value, args }) { + if (Array.isArray(value)) { + return `Kuna buƙatar aƙalla ${args[0]} ${name}.` + } + const force = Array.isArray(args) && args[1] ? args[1] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `Dole ne ${s(name)} ya zama a kalla ${args[0]}.` + } + return `Dole ne ${s(name)} ya zama mai haruffa a kalla ${args[0]}.` + }, + + /** + * The field is not an allowed value + */ + not: function ({ name, value }) { + return `“${value}” ba mai amsuwa ba ne ${name}.` + }, + + /** + * The field is not a number + */ + number: function ({ name }) { + return `Dole ${s(name)} ya zama lamba.` + }, + + /** + * Required field. + */ + required: function ({ name }) { + return `Ana bukatar ${s(name)}.` + }, + + /** + * Starts with specified value + */ + startsWith: function ({ name, value }) { + if (!value) { + return `Wannan filin bai fara da adadi mai inganci ba.` + } + return `“${value}” bai fara da adadi mai inganci ba.` + }, + + /** + * Value is not a url. + */ + url: function ({ name }) { + return `Da fatan za a hada da ingantaccen url.` + } +} + +/** + * This creates a vue-formulate plugin that can be imported and used on each + * project. + */ +export default function (instance) { + instance.extend({ + locales: { + [locale]: localizedValidationMessages + } + }) +} diff --git a/src/locales/ig.js b/src/locales/ig.js new file mode 100644 index 0000000..cde4b84 --- /dev/null +++ b/src/locales/ig.js @@ -0,0 +1,234 @@ +/** + * Here we can import additional helper functions to assist in formatting our + * language. Feel free to add additional helper methods to libs/formats if it + * assists in creating good validation messages for your locale. + */ + import { sentence as s } from '../libs/formats' + + /** + * This is the ISO 639-1 and (optionally) ISO 639-2 language "tag". + * Some valid examples: + * zh + * zh-CN + * zh-HK + * en + * en-GB + */ + const locale = 'ig' + + /** + * This is an object of functions that each produce valid responses. There's no + * need for these to be 1-1 with english, feel free to change the wording or + * use/not use any of the variables available in the object or the + * arguments for the message to make the most sense in your language and culture. + * + * The validation context object includes the following properties: + * { + * args // Array of rule arguments: between:5,10 (args are ['5', '10']) + * name: // The validation name to be used + * value: // The value of the field (do not mutate!), + * vm: the // FormulateInput instance this belongs to, + * formValues: // If wrapped in a FormulateForm, the value of other form fields. + * } + */ + const localizedValidationMessages = { + + /** + * Valid accepted value. + */ + accepted: function ({ name }) { + return `Biko nabata ${name}.` + }, + + /** + * The date is not after. + */ + after: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} ga-enwerịrị mgbe ${args[0]}.` + } + return `${s(name)} ga-abụ ụbọchị na-esote.` + }, + + /** + * The value is not a letter. + */ + alpha: function ({ name }) { + return `${s(name)} nwere ike ịnwe mkpụrụedemede naanị.` + }, + + /** + * Rule: checks if the value is alpha numeric + */ + alphanumeric: function ({ name }) { + return `${s(name)} nwere ike ibu naanị leta na nọmba.` + }, + + /** + * The date is not before. + */ + before: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} ga-anọru ${args[0]}.` + } + return `${s(name)} ga-abụrịrị ụbọchị gara aga.` + }, + + /** + * The value is not between two numbers or lengths + */ + between: function ({ name, value, args }) { + const force = Array.isArray(args) && args[2] ? args[2] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} must be between ${args[0]} and ${args[1]}.` + } + return `${s(name)} ga-adị n'etit ${args[0]} na mkpụrụedemede ${args[1]} ogologo.` + }, + + /** + * The confirmation field does not match + */ + confirm: function ({ name, args }) { + return `${s(name)} adabaghị.` + }, + + /** + * Is not a valid date. + */ + date: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} abụghị ezigbo ụbọchị, biko jiri usoro ${args[0]}` + } + return `${s(name)} abụghị ezigbo ụbọchị.` + }, + + /** + * The default render method for error messages. + */ + default: function ({ name }) { + return `Ala a anaghị arụ ọrụ.` + }, + + /** + * Is not a valid email address. + */ + email: function ({ name, value }) { + if (!value) { + return 'Biko tinye adreesị ozi ịntanetị dabara adaba.' + } + return `“${value}” abụghị ezigbo adreesị ozi-e.` + }, + + /** + * Ends with specified value + */ + endsWith: function ({ name, value }) { + if (!value) { + return `Ala a anaghị ejedebe uru dị irè.` + } + return `“${value}” anaghị ejedebe uru bara uru.` + }, + + /** + * Value is an allowed value. + */ + in: function ({ name, value }) { + if (typeof value === 'string' && value) { + return `“${s(value)}” abụghị ezigbo ${name}.` + } + return `Nke a ekweghi ${name}.` + }, + + /** + * Value is not a match. + */ + matches: function ({ name }) { + return `${s(name)} abụghị uru kwere.` + }, + + /** + * The maximum value allowed. + */ + max: function ({ name, value, args }) { + if (Array.isArray(value)) { + return `I nwere ike họrọ naanị ${args[0]} ${name}.` + } + const force = Array.isArray(args) && args[1] ? args[1] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} ga-erughị ma ọ bụ hara ka ${args[0]}.` + } + return `${s(name)} ga-erugharị ma ọ bụ hara ka mkpụrụedemede ${args[0]}.` + }, + + /** + * The (field-level) error message for mime errors. + */ + mime: function ({ name, args }) { + return `${s(name)} ga-abụrịrị nke ụdị ahụ: ${args[0] || 'Onweghị ụdị faịlị kwere..'}` + }, + + /** + * The maximum value allowed. + */ + min: function ({ name, value, args }) { + if (Array.isArray(value)) { + return `I choro opekata mpe ${args[0]} ${name}.` + } + const force = Array.isArray(args) && args[1] ? args[1] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} ga-abụrịrị opekata mpe ${args[0]}.` + } + return `${s(name)} ga-opekata mpe mkpụrụ edemede ${args[0]} ogologo.` + }, + + /** + * The field is not an allowed value + */ + not: function ({ name, value }) { + return `“${value}” abụghị ikike ${name}.` + }, + + /** + * The field is not a number + */ + number: function ({ name }) { + return `${s(name)} ga-abụ ọnụ ọgụgụ.` + }, + + /** + * Required field. + */ + required: function ({ name }) { + return `${s(name)} achọrọ.` + }, + + /** + * Starts with specified value + */ + startsWith: function ({ name, value }) { + if (!value) { + return `Ala a anaghị ebido uru bara uru.` + } + return `“${value}” anaghị ebido uru bara uru.` + }, + + /** + * Value is not a url. + */ + url: function ({ name }) { + return `Biko tinye url ziri ezi.` + } + } + + /** + * This creates a vue-formulate plugin that can be imported and used on each + * project. + */ + export default function (instance) { + instance.extend({ + locales: { + [locale]: localizedValidationMessages + } + }) + } + \ No newline at end of file diff --git a/src/locales/yo.js b/src/locales/yo.js new file mode 100644 index 0000000..3ae2cca --- /dev/null +++ b/src/locales/yo.js @@ -0,0 +1,234 @@ +/** + * Here we can import additional helper functions to assist in formatting our + * language. Feel free to add additional helper methods to libs/formats if it + * assists in creating good validation messages for your locale. + */ + import { sentence as s } from '../libs/formats' + + /** + * This is the ISO 639-1 and (optionally) ISO 639-2 language "tag". + * Some valid examples: + * zh + * zh-CN + * zh-HK + * en + * en-GB + */ + const locale = 'yo' + + /** + * This is an object of functions that each produce valid responses. There's no + * need for these to be 1-1 with english, feel free to change the wording or + * use/not use any of the variables available in the object or the + * arguments for the message to make the most sense in your language and culture. + * + * The validation context object includes the following properties: + * { + * args // Array of rule arguments: between:5,10 (args are ['5', '10']) + * name: // The validation name to be used + * value: // The value of the field (do not mutate!), + * vm: the // FormulateInput instance this belongs to, + * formValues: // If wrapped in a FormulateForm, the value of other form fields. + * } + */ + const localizedValidationMessages = { + + /** + * Valid accepted value. + */ + accepted: function ({ name }) { + return `Jọwọ gba awọn ${name}.` + }, + + /** + * The date is not after. + */ + after: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} gbọdọ jẹ lẹhin ${args[0]}.` + } + return `${s(name)} gbọdọ jẹ ọjọ ti o pẹ.` + }, + + /** + * The value is not a letter. + */ + alpha: function ({ name }) { + return `${s(name)} le ni awọn ohun kikọ labidi nikan.` + }, + + /** + * Rule: checks if the value is alpha numeric + */ + alphanumeric: function ({ name }) { + return `${s(name)} le nikan ni awọn lẹta ati awọn nọmba ninu.` + }, + + /** + * The date is not before. + */ + before: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} gbọdọ wa ṣaaju ${args[0]}.` + } + return `${s(name)} gbọdọ jẹ ọjọ iṣaaju.` + }, + + /** + * The value is not between two numbers or lengths + */ + between: function ({ name, value, args }) { + const force = Array.isArray(args) && args[2] ? args[2] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} gbọdọ wa laarin awọn ${args[0]} ati ${args[1]}.` + } + return `${s(name)} gbọdọ wa laarin awọn ${args[0]} ati awọn ohun kikọ ${args[1]} pẹ.` + }, + + /** + * The confirmation field does not match + */ + confirm: function ({ name, args }) { + return `${s(name)} ko baramu.` + }, + + /** + * Is not a valid date. + */ + date: function ({ name, args }) { + if (Array.isArray(args) && args.length) { + return `${s(name)} kii ṣe ọjọ ti o wulo, jọwọ lo ọna kika ${args[0]}` + } + return `${s(name)} kii ṣe ọjọ to wulo.` + }, + + /** + * The default render method for error messages. + */ + default: function ({ name }) { + return `Aaye yii ko wulo.` + }, + + /** + * Is not a valid email address. + */ + email: function ({ name, value }) { + if (!value) { + return 'Jowo fun fun wa ni imeli re to je otito.' + } + return `“${value}” kii ṣe adirẹsi imeeli to wulo.` + }, + + /** + * Ends with specified value + */ + endsWith: function ({ name, value }) { + if (!value) { + return `Aaye yii ko pari pẹlu iye to wulo.` + } + return `“${value}” ko pari pẹlu iye to wulo.` + }, + + /** + * Value is an allowed value. + */ + in: function ({ name, value }) { + if (typeof value === 'string' && value) { + return `“${s(value)}” kii ṣe ${name} ti o gba laaye.` + } + return `Eyi kii ṣe ${name} ti o gba laaye.` + }, + + /** + * Value is not a match. + */ + matches: function ({ name }) { + return `${s(name)} kii ṣe iye ti a gba laaye.` + }, + + /** + * The maximum value allowed. + */ + max: function ({ name, value, args }) { + if (Array.isArray(value)) { + return `O le yan ${args[0]} ${name} nikan.` + } + const force = Array.isArray(args) && args[1] ? args[1] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} gbọdọ jẹ kere ju tabi dogba si ${args[0]}.` + } + return `${s(name)} gbọdọ jẹ kere ju tabi dogba si awọn ohun kikọ ${args[0]} pẹ.` + }, + + /** + * The (field-level) error message for mime errors. + */ + mime: function ({ name, args }) { + return `${s(name)} gbọdọ jẹ ti iru: ${args[0] || 'Ko si awọn ọna kika faili laaye.'}` + }, + + /** + * The maximum value allowed. + */ + min: function ({ name, value, args }) { + if (Array.isArray(value)) { + return `O nilo ni o kere ${args[0]} ${name}.` + } + const force = Array.isArray(args) && args[1] ? args[1] : false + if ((!isNaN(value) && force !== 'length') || force === 'value') { + return `${s(name)} gbọdọ jẹ o kere ${args[0]}.` + } + return `${s(name)} gbọdọ jẹ o kere ju awọn kikọ ${args[0]} gun.` + }, + + /** + * The field is not an allowed value + */ + not: function ({ name, value }) { + return `“${value}” kii ṣe ${name} ti o gba laaye.` + }, + + /** + * The field is not a number + */ + number: function ({ name }) { + return `${s(name)} gbọdọ jẹ nọmba kan.` + }, + + /** + * Required field. + */ + required: function ({ name }) { + return `${s(name)} nilo.` + }, + + /** + * Starts with specified value + */ + startsWith: function ({ name, value }) { + if (!value) { + return `Aaye yii ko bẹrẹ pẹlu iye to wulo.` + } + return `“${value}” ko bẹrẹ pẹlu iye to wulo.` + }, + + /** + * Value is not a url. + */ + url: function ({ name }) { + return `Jọwọ ṣafikun url to wulo kan.` + } + } + + /** + * This creates a vue-formulate plugin that can be imported and used on each + * project. + */ + export default function (instance) { + instance.extend({ + locales: { + [locale]: localizedValidationMessages + } + }) + } + \ No newline at end of file