export const sv = {
  "Subscription number": "Prenumerationsnummer",
  Advanced: "Avancerat",
  "Create subscription": "Skapa prenumeration",
  Subscription: "Prenumeration",
  "Start date": "Startdatum",
  "End date": "Slutdatum",
  "Cancelling subscription...": "Avbryter prenumerationen ...",
  "Subscription was cancelled.": "Prenumerationen avbröts.",
  "Failed to cancel subscription.": "Misslyckades med att avbryta prenumerationen.",
  "Cancel subscription": "Avbryt prenumeration",
  "Unknown date": "Okänt datum",
  Ongoing: "Tillsvidare",
  Number: "Nummer",
  None: "Ingen",
  Start: "Start",
  End: "Avslut",
  Amount: "Summa",
  Schedule: "Schema",
  "Invalid Schedule": "Ogiltigt Schema",
  "Next Payment": "Nästa Betalning",
  Qty: "Antal",
  Name: "Namn",
  Price: "Pris",
  VAT: "Moms",
  daily: "Daglig",
  weekly: "Veckovis",
  monthly: "Månadsvis",
  quarterly: "Kvartalsvis",
  yearly: "Årlig",
  Day: "Dag",
  "Add item": "Lägg till artikel",
  every: "var",
  year: "år",
  month: "månad",
  quarter: "kvartal",
  week: "vecka",
  day: "dag",
  of: "av",
  "of every": "av varje",
  "to last": "sista",
  "starting from the": "med början",
  "starting from": "med början",
  "on the": "den",
  monday: "måndag",
  tuesday: "tisdag",
  wednesday: "onsdag",
  thursday: "torsdag",
  friday: "fredag",
  saturday: "lördag",
  sunday: "söndag",
  january: "januari",
  february: "februari",
  march: "mars",
  april: "april",
  june: "juni",
  july: "juli",
  august: "augusti",
  september: "september",
  october: "oktober",
  november: "november",
  december: "december",
  ordinals: (data) => {
    let result = data;
    if (data.match(/^\d+(st|nd|rd|th)$/)) {
      let numberPart = Number.parseInt(data);
      numberPart = Math.abs(Math.floor(numberPart));
      result = numberPart.toString().match(/(^(1|2)|[^1](1|2))$/) ? numberPart + "a" : numberPart + "e";
    }
    return result;
  },
  onThe: (data) => {
    let result = data;
    let matchResult;
    if ((matchResult = data.match(/on the \d+(?:st|nd|rd|th) (?:month|year|quarter|day|week)/)) != null &&
      matchResult.length > 0) {
      let indexBefore = 0;
      let indexAfter = 0;
      result = data.replace(/on the \d+(?:st|nd|rd|th) (?:month|year|quarter|day|week)/, "¤" + (indexBefore += 1));
      matchResult.forEach(r => {
        let index;
        while ((index = r.search(/\d(st|nd|rd|th)/)) > -1)
          r = r.substring(0, index + 1) + r.substring(index + 3, r.length);
        const rCadenceMatch = r.match(/(month|year|quarter|day|week)/);
        const cadenceLength = rCadenceMatch != null && rCadenceMatch.length > 0 ? rCadenceMatch[0].length : 1;
        const rDigitsMatch = r.match(/\d+/);
        const digitsLength = rDigitsMatch != null && rDigitsMatch.length > 0 ? rDigitsMatch[0].length : 1;
        const digits = r.substring("on the ".length, "on the ".length + digitsLength);
        const cadence = r.substring(r.length - cadenceLength, r.length);
        result = result.replace("¤" + (indexAfter += 1), cadence + " " + digits);
      });
    }
    return result;
  },
};
