Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@schedule-x/translations

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@schedule-x/translations - npm Package Compare versions

Comparing version 0.1.0-alpha.1 to 0.1.0-alpha.2

./dist/core.cjs.js

24

dist/core.cjs.js

@@ -6,3 +6,3 @@ 'use strict';

const datePickerDeDE = {
'Date': 'Datum',
Date: 'Datum',
'MM/DD/YYYY': 'TT.MM.JJJJ',

@@ -14,7 +14,7 @@ 'Next month': 'Nächster Monat',

const deDE = {
...datePickerDeDE
...datePickerDeDE,
};
const datePickerEnUS = {
'Date': 'Date',
Date: 'Date',
'MM/DD/YYYY': 'MM/DD/YYYY',

@@ -26,8 +26,16 @@ 'Next month': 'Next month',

const enUS = {
...datePickerEnUS
...datePickerEnUS,
};
class InvalidLocaleError extends Error {
constructor(locale) {
super(`Invalid locale: ${locale}`);
}
}
const translate = (locale, languages) => (key) => {
locale = locale.replace('-', '');
const language = languages[locale];
if (!/^[a-z]{2}-[A-Z]{2}$/.test(locale))
throw new InvalidLocaleError(locale);
const deHyphenatedLocale = locale.replace('-', '');
const language = languages[deHyphenatedLocale];
if (!language)

@@ -40,7 +48,7 @@ return key;

deDE,
enUS
enUS,
};
const datePickerTranslations = {
deDE: datePickerDeDE,
enUS: datePickerEnUS
enUS: datePickerEnUS,
};

@@ -47,0 +55,0 @@

const datePickerDeDE = {
'Date': 'Datum',
Date: 'Datum',
'MM/DD/YYYY': 'TT.MM.JJJJ',

@@ -9,7 +9,7 @@ 'Next month': 'Nächster Monat',

const deDE = {
...datePickerDeDE
...datePickerDeDE,
};
const datePickerEnUS = {
'Date': 'Date',
Date: 'Date',
'MM/DD/YYYY': 'MM/DD/YYYY',

@@ -21,8 +21,16 @@ 'Next month': 'Next month',

const enUS = {
...datePickerEnUS
...datePickerEnUS,
};
class InvalidLocaleError extends Error {
constructor(locale) {
super(`Invalid locale: ${locale}`);
}
}
const translate = (locale, languages) => (key) => {
locale = locale.replace('-', '');
const language = languages[locale];
if (!/^[a-z]{2}-[A-Z]{2}$/.test(locale))
throw new InvalidLocaleError(locale);
const deHyphenatedLocale = locale.replace('-', '');
const language = languages[deHyphenatedLocale];
if (!language)

@@ -35,9 +43,9 @@ return key;

deDE,
enUS
enUS,
};
const datePickerTranslations = {
deDE: datePickerDeDE,
enUS: datePickerEnUS
enUS: datePickerEnUS,
};
export { datePickerTranslations, deDE, enUS, translate, translations };

@@ -8,3 +8,3 @@ (function (global, factory) {

const datePickerDeDE = {
'Date': 'Datum',
Date: 'Datum',
'MM/DD/YYYY': 'TT.MM.JJJJ',

@@ -16,7 +16,7 @@ 'Next month': 'Nächster Monat',

const deDE = {
...datePickerDeDE
...datePickerDeDE,
};
const datePickerEnUS = {
'Date': 'Date',
Date: 'Date',
'MM/DD/YYYY': 'MM/DD/YYYY',

@@ -28,8 +28,16 @@ 'Next month': 'Next month',

const enUS = {
...datePickerEnUS
...datePickerEnUS,
};
class InvalidLocaleError extends Error {
constructor(locale) {
super(`Invalid locale: ${locale}`);
}
}
const translate = (locale, languages) => (key) => {
locale = locale.replace('-', '');
const language = languages[locale];
if (!/^[a-z]{2}-[A-Z]{2}$/.test(locale))
throw new InvalidLocaleError(locale);
const deHyphenatedLocale = locale.replace('-', '');
const language = languages[deHyphenatedLocale];
if (!language)

@@ -42,7 +50,7 @@ return key;

deDE,
enUS
enUS,
};
const datePickerTranslations = {
deDE: datePickerDeDE,
enUS: datePickerEnUS
enUS: datePickerEnUS,
};

@@ -49,0 +57,0 @@

@@ -5,10 +5,10 @@ import { deDE } from './locales/de-DE';

declare const translations: {
deDE: import("./interfaces/language.translations").Language;
enUS: import("./interfaces/language.translations").Language;
deDE: import("./types/date-picker.translations").DatePickerTranslations;
enUS: import("./types/date-picker.translations").DatePickerTranslations;
};
declare const datePickerTranslations: {
deDE: import("./interfaces/date-picker.translations").DatePickerTranslations;
enUS: import("./interfaces/date-picker.translations").DatePickerTranslations;
deDE: import("./types/date-picker.translations").DatePickerTranslations;
enUS: import("./types/date-picker.translations").DatePickerTranslations;
};
export type TranslateFn = (key: string) => string;
export { translate, translations, datePickerTranslations, deDE, enUS, };
export { translate, translations, datePickerTranslations, deDE, enUS };

@@ -1,2 +0,2 @@

import { DatePickerTranslations } from '../../interfaces/date-picker.translations';
import { DatePickerTranslations } from '../../types/date-picker.translations';
export declare const datePickerDeDE: DatePickerTranslations;

@@ -1,2 +0,2 @@

import { Language } from '../../interfaces/language.translations';
import { Language } from '../../types/language.translations';
export declare const deDE: Language;

@@ -1,2 +0,2 @@

import { DatePickerTranslations } from '../../interfaces/date-picker.translations';
import { DatePickerTranslations } from '../../types/date-picker.translations';
export declare const datePickerEnUS: DatePickerTranslations;

@@ -1,2 +0,2 @@

import { Language } from '../../interfaces/language.translations';
import { Language } from '../../types/language.translations';
export declare const enUS: Language;
{
"name": "@schedule-x/translations",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "Schedule-X translations",

@@ -17,5 +17,2 @@ "author": {

],
"dependencies": {
"preact": "^10.16.0"
},
"repository": {

@@ -26,3 +23,3 @@ "type": "git",

},
"gitHead": "08e4f6ae6f96e63570e75acd14041271d1d1c59e"
"gitHead": "052aa6562e27bd1776de750b3054ee45daf7a39a"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc