-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
261 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
export const APP_TYPE = { | ||
KONNECTOR: 'konnector', | ||
WEBAPP: 'webapp' | ||
WEBAPP: 'webapp', | ||
FILE: 'file' | ||
} | ||
|
||
export const APP_CLASS = { | ||
SHORTCUT: 'shortcut' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export const generateI18nConfig = (categories?: { | ||
[key: string]: string | ||
}): { | ||
en: Record<string, string> | ||
fr: Record<string, string> | ||
} => { | ||
if (!categories) return { en: {}, fr: {} } | ||
|
||
const i18nConfig: Record<string, string> = {} | ||
|
||
for (const [key, value] of Object.entries(categories)) { | ||
// Extract the final part of the path as the display name | ||
const displayName = | ||
value?.split('/').pop() ?? ''.replace(/([A-Z])/g, ' $1').trim() | ||
|
||
i18nConfig[`app_categories.${key}`] = displayName | ||
} | ||
|
||
return { | ||
en: i18nConfig, | ||
fr: i18nConfig | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import _get from 'lodash/get' | ||
|
||
import { APP_CLASS, APP_TYPE } from './constants' | ||
|
||
export const getTranslatedManifestProperty = (app, path, t) => { | ||
if (!t || !app || !path) return _get(app, path, '') | ||
return t(`apps.${app.slug}.${path}`, { | ||
_: _get(app, path, '') | ||
}) | ||
} | ||
|
||
export const isShortcutFile = app => { | ||
if (!app) return false | ||
|
||
return app.type === APP_TYPE.FILE && app.class === APP_CLASS.SHORTCUT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.