Skip to content

Localization ​

The library ships English and Arabic for its built-in control strings (the "Close", "Clear selection", "Empty", and move-button labels inside components). Provide a config at the root of your app to switch locale; every component that reads a built-in string also keeps its own label prop, so a provider is only the default source.

Providing a config ​

vue
<script setup lang="ts">
import { createConfig, provideMyGhfConfig } from '@myghf/ui'

provideMyGhfConfig(createConfig({ locale: 'ar' }))
</script>

createConfig picks the label set for the locale's base language (ar-EG → ar), falling back to English, and merges any labels you pass on top:

ts
const config = createConfig({
  locale: 'ar-EG',
  labels: { close: 'إغلاق النافذة' }, // overrides just this string
})
ExportPurpose
createConfig(options?)Builds a MyGhfConfig ({ locale, labels }).
provideMyGhfConfig(config)Provides it to the component tree (and returns it).
useMyGhfConfig()Reads the nearest config, or the English default outside a provider.
myghfConfigKeyThe injection key, if you prefer provide/inject directly.
defaultConfigThe English default.

Built-in labels ​

These are the strings currently read from the config (English / Arabic):

KeyEnglishArabic
closeCloseإغلاق
clearClearمسح
clearSelectionClear selectionمسح التحديد
togglePasswordVisibilityToggle password visibilityإظهار كلمة المرور
showOptionsShow optionsعرض الخيارات
emptyEmptyلا توجد عناصر
moveSelectedToTargetMove selected to targetنقل المحدد إلى الوجهة
moveSelectedToSourceMove selected to sourceنقل المحدد إلى المصدر
moveAllToTargetMove all to targetنقل الكل إلى الوجهة
moveAllToSourceMove all to sourceنقل الكل إلى المصدر
drawerTitleDrawerلوحة جانبية
formErrorsTitlePlease fix the following:يرجى تصحيح ما يلي:
emptyResultsNo resultsلا توجد نتائج
loadingLoading…جارٍ التحميل…
selectAllRowsSelect all rowsتحديد كل الصفوف
selectRowSelect rowتحديد الصف
selectedselectedمحدد
toggleRowToggle rowتبديل الصف
searchSearchبحث
searchPlaceholderSearch…بحث…
noResultsMatchFiltersNo results match your filtersلا توجد نتائج مطابقة لعوامل التصفية
clearFiltersClear filtersمسح عوامل التصفية
typeACommandType a command…اكتب أمرًا…
searchCommandsSearch commandsبحث في الأوامر
commandPaletteCommand paletteلوحة الأوامر
commandPaletteDescriptionSearch for and run a command.ابحث عن أمر وشغّله.
dropFilesPromptDrag and drop files here, orاسحب وأفلت الملفات هنا، أو
browsebrowseتصفح
removeRemoveإزالة
rowsPerPageRows per pageصفوف لكل صفحة
ofofمن
previousPagePrevious pageالصفحة السابقة
nextPageNext pageالصفحة التالية

Label props that have a config key (e.g. DataTable's emptyLabel, TablePagination's previousLabel, CommandPalette's title, FileUpload's prompt) default to the config label; set the prop to override. A few props without a config key (e.g. Tag's removeLabel) stay prop-only.

Direction and fonts ​

Localization and direction are separate concerns: set dir="rtl" and the Arabic font stack at the edge of an RTL subtree — see RTL & bilingual. Setting locale: 'ar' changes the strings, not the direction.

Number and date formatting ​

DatePicker, TimePicker, and InputNumber format through the config's locale: the locale prop wins, then the provider's locale, then the runtime locale. So a config with locale: 'ar' localizes their dates, times, and numbers without per-component props. The formatLocalizedDate / formatLocalizedTime / browserLocale helpers and the number utilities cover the rest.

Released under the MIT License.