PluginProbe
The Innovative Form Builder – IvyForms / 0.1.2
The Innovative Form Builder – IvyForms v0.1.2
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / frontend / src / composables / useLabels.ts

useLabels.ts in The Innovative Form Builder – IvyForms 0.1.2, at frontend/src/composables/useLabels.ts

25 lines 687 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useLabelsStore } from '@/stores/labels'
2
3 /**
4 * Composable function to provide easy access to labels throughout the application
5 * @returns Object with getLabel function and allLabels getter
6 */
7 export function useLabels() {
8 const labelsStore = useLabelsStore()
9
10 /**
11 * Get a label by key with optional fallback value
12 * @param key The label key to retrieve
13 * @param fallback Optional fallback text if label doesn't exist
14 * @returns The label string or fallback value
15 */
16 const getLabel = (key: string, fallback: string = ''): string => {
17 return labelsStore.getLabel(key, fallback)
18 }
19
20 return {
21 getLabel,
22 allLabels: labelsStore.allLabels,
23 }
24 }
25