▦K2 Advanced GridsDeveloper Portal / 0.23
Documentation / Developer reference

Localization & RTL

Build multilingual K2 SmartForms with English and Arabic grid controls, mixed-language business data and direction-aware layouts. This reference explains what K2 Advanced Grids localizes itself, what remains the responsibility of the host application, and how to configure and validate localization in Engine Beta 1.0.

Three independent layers

LayerOwnerExamples
Component UIK2 Advanced GridsFilter operators, pagination, column menus, summary scope and Boolean labels.
Host applicationK2 SmartForms / browserNative toolbar captions, column titles, native cell formatting and ListView direction.
Business dataSmartObject / source systemVendor names, departments, descriptions, status values and identifiers.

Changing the component language does not translate business records, change the K2 culture, or mirror the entire form. An English grid can contain Arabic values and vice versa.

Language selection

Set the language at the root of the configuration, not inside an individual grid. The built-in dictionaries are en and ar.

SettingBehavior
language: "auto"Uses the value of #CurrentCulture, then the HTML lang attribute, then en.
language: "en"Forces English component controls.
language: "ar"Forces Arabic component controls and RTL for direction-aware component elements.
localization.languageTakes precedence over root language when nonempty.
localization.languagesCustom language entries keyed by lowercase language or culture code.
localization.defaultLanguageDictionary used when neither the exact nor base language matches; otherwise English.
localization.fallbackLanguageOptional intermediate translation dictionary; not a replacement for the selected language.
// Apply BEFORE the engine is initialized, in the existing config file.
window.K2AdvancedGridsConfig.language = 'auto';
// Alternatives: 'en', 'ar', 'en-US', 'ar-SA'.
// Ensure localization.language is absent or set to the same choice.

Culture resolution lowercases the requested code, tries an exact entry (e.g. ar-sa), then its base language (ar), then defaultLanguage, then English. The original lowercased requested code is retained for locale-aware formatting. Translation merge order: English baseline → optional fallback dictionary → built-in Arabic for ar-* → selected entry translations. Later values win. Custom entries replace the corresponding language entry, so always declare direction explicitly; do not assume a partial English or Arabic entry preserves every property.

Custom dictionaries

Use a separate exact culture entry to customize wording without replacing the built-in base dictionary. Custom strings are application-owned; this example changes selected labels only.

window.K2AdvancedGridsConfig.localization = {
  language: 'ar-SA',
  defaultLanguage: 'en',
  fallbackLanguage: 'en',
  languages: {
    'ar-sa': {
      direction: 'rtl',
      translations: {
        apply: 'تطبيق',
        reset: 'إزالة جميع عوامل التصفية',
        manageColumns: 'إدارة الأعمدة',
        page: 'الصفحة {page} من {pages}',
        range: 'عرض {from}–{to} من {count} ({total})',
        yes: 'نعم',
        no: 'لا'
      }
    }
  }
};

Keep interpolation tokens unchanged. A custom non-Arabic dictionary inherits English for omitted keys unless a fallback supplies them. Use valid BCP 47 language tags to avoid failures in locale-aware comparisons. The Beta does not expose every UI string as a translation key: Cards and Export include direction-based English/Arabic labels, and other fixed strings or custom captions may remain unchanged. A third-language dictionary therefore does not imply complete translation.

Built-in translation keys

The following inventory is extracted from the frozen engine dictionaries. Use exact case-sensitive keys. It is not a list of every visible string in the application.

KeyEnglishArabic
filterFilterتصفية
applyApplyتطبيق
clearClearمسح
cancelCancelإلغاء
allSelect allتحديد الكل
searchSearch valuesالبحث عن القيم
empty(Empty)(فارغ)
containsContainsيحتوي على
notcontainsDoes not containلا يحتوي على
eqEqualsيساوي
neDoes not equalلا يساوي
startsStarts withيبدأ بـ
endsEnds withينتهي بـ
blankIs emptyفارغ
notblankIs not emptyغير فارغ
ltLess than / Beforeأقل من / قبل
leLess than or equalأقل من أو يساوي
gtGreater than / Afterأكبر من / بعد
geGreater than or equalأكبر من أو يساوي
betweenBetween (inclusive)بين قيمتين (شامل)
todayTodayاليوم
weekLast 7 daysآخر ٧ أيام
monthThis monthهذا الشهر
valueValueالقيمة
invalidEnter valid filter valuesأدخل قيماً صالحة
resetClear all filtersمسح جميع عوامل التصفية
countShowing {visible} of {total} loaded recordsعرض {visible} من {total} سجل محمّل
noneNo matching recordsلا توجد سجلات مطابقة
yesYesنعم
noNoلا
pagePage {page} of {pages}الصفحة {page} من {pages}
rangeShowing {from}–{to} of {count} matching ({total} loaded)عرض {from}–{to} من {count} سجل مطابق ({total} محمّل)
pageSizeRows per pageعدد الصفوف لكل صفحة
firstFirst pageالصفحة الأولى
lastLast pageالصفحة الأخيرة
previousPrevious pageالصفحة السابقة
nextNext pageالصفحة التالية
loadMoreLoad more...تحميل المزيد...
allDisplayedAll matching records displayedتم عرض جميع السجلات المطابقة
noRecordsNo matching recordsلا توجد سجلات مطابقة
activeFiltersActive filtersعوامل التصفية النشطة
removeFilterRemove filterإزالة عامل التصفية
selectedValuesselected valuesقيم محددة
noValuesNo values selectedلم يتم تحديد قيم
summarySummaryالملخص
filteredScopeAll matching recordsجميع السجلات المطابقة
loadedScopeAll loaded recordsجميع السجلات المحملة
pageScopeCurrent pageالصفحة الحالية
countRowsRecordsالسجلات
countNonblankCountالعدد
countDistinctDistinctعدد القيم الفريدة
sumSumالمجموع
avgAverageالمتوسط
minMinimumالحد الأدنى
maxMaximumالحد الأقصى
manageColumnsManage columnsإدارة الأعمدة
searchColumnsSearch columns...البحث عن الأعمدة...
visibleColumns{visible} of {total} columns visible{visible} من {total} أعمدة ظاهرة
showAllShow allإظهار الكل
hideAllHide allإخفاء الكل
resetColumnsResetإعادة تعيين
hideColumnHide columnإخفاء العمود
requiredColumnRequired columnعمود إلزامي
sortAscSort ascendingترتيب تصاعدي
sortDescSort descendingترتيب تنازلي
clearFilterClear filterمسح عامل التصفية
autoFitAutoFit widthضبط العرض تلقائياً
resetWidthReset widthإعادة تعيين العرض
groupedByGrouped by:التجميع حسب:
expandGroupsExpand allتوسيع الكل
collapseGroupsCollapse allطي الكل
groupByGroup by this columnتجميع حسب هذا العمود
groupAddAdd to groupingإضافة إلى التجميع
groupRemoveRemove from groupingإزالة من التجميع
groupClearClear all groupingمسح التجميع
pinStartPin to startتثبيت في البداية
pinEndPin to endتثبيت في النهاية
unpinUnpin columnإلغاء تثبيت العمود
unpinAllUnpin allإلغاء تثبيت الكل
moveEarlierMove toward startنقل نحو البداية
moveLaterMove toward endنقل نحو النهاية
resetOrderReset column orderإعادة تعيين ترتيب الأعمدة

RTL and logical positioning

Direction-aware component elements include filter and column dialogs, active filter bars, pagination, summary content, grouping controls and cards. Pagination arrows and data-bar direction adapt to the selected component direction. The host ListView itself is not globally mirrored by the language setting. Column pinning uses the computed CSS direction of the actual grid body, not the translation dictionary.

Logical settingLTR hostRTL host
Pin to start / pinnedStartLeft edgeRight edge
Pin to end / pinnedEndRight edgeLeft edge
Move toward start / endEarlier / later logical orderEarlier / later logical order

Configure the native K2 form and ListView for the intended direction before testing pinning or reordering. Avoid global CSS overrides of all tables or cells. The column-aligned summary track uses an internal LTR coordinate system; do not override it to force RTL.

// Read-only direction diagnostic; run after initialization.
console.table(K2AdvancedGrids.discover().map(g => {
  const root = [...document.querySelectorAll('.grid[data-areaitemid]')]
    .find(n => n.dataset.areaitemid === g.areaItemId);
  const body = root?.querySelector('.grid-body');
  return {
    areaItemId: g.areaItemId,
    culture: document.querySelector('#CurrentCulture')?.value,
    htmlLang: document.documentElement.lang,
    gridDirection: body ? getComputedStyle(body).direction : null,
    componentDirection: root?.querySelector('.k2ag-cards, .k2ag-group-bar')?.dir || null
  };
}));

A null componentDirection simply means neither of the inspected elements is present. See Column pinning and Column reordering.

Mixed English and Arabic business data

Use the original SmartObject values in filter conditions, grouping and status mappings. Translating the visible caption does not translate the underlying value. Prefer stable Runtime column keys or control names where supported; title-based mappings must be revisited if K2 column captions are translated. Verify actual keys using JavaScript API (inspect).

English ListView with Arabic and English vendor and department values
Existing Purchase Orders Runtime capture: mixed Arabic and English values in an English interface. This demonstrates bilingual data, not a fully mirrored Arabic form.

Text comparisons normalize Unicode using NFKC, remove selected bidi marks, trim whitespace and lowercase text. Arabic-Indic and Eastern Arabic-Indic digits are normalized for typed comparisons. Category selection uses original values (except normalized Boolean categories); it does not automatically merge translated or differently spelled categories. Grouped text sorting uses localeCompare with the requested locale; category option sorting uses the browser default locale. Native ungrouped sorting remains subject to K2 behavior.

Numbers, dates and Boolean values

TypeEngine behaviorRecommendation
Number / DecimalTyped comparisons accept ungrouped digits and decimal point or Arabic decimal separator. Grouping separators are not removed.Use raw ungrouped values such as 1234.50 or ١٢٣٤٫٥٠; do not use 1,234.50 as a numeric filter value.
SummaryNumeric aggregate formatting uses Intl.NumberFormat with requested locale; count values are plain strings.Check digit shapes, precision and separators; native cells retain K2 formatting.
DateCompares raw YYYY-MM-DD date portion.Use Gregorian ISO values, not localized display captions or Hijri strings.
DateTimeParses ISO-like date/time with Z or offset; no offset means browser local time. Relative filters use browser-local calendar days.Test midnight and timezone boundaries; do not assume K2 display timezone matches browser.
TimeParses HH:mm with optional seconds/fraction.Use 24-hour raw time.
Yes/NoRecognizes true/false, 1/0, yes/no; auto labels use dictionary.Arabic display labels are not accepted as raw Boolean equivalents.
// Existing Boolean formatting settings (merge with other defaults).
Object.assign(window.K2AdvancedGridsConfig.defaults.booleanFormatting, {
  enabled: true,
  mode: 'badge',
  trueText: 'auto',
  falseText: 'auto',
  alignment: 'start'
});

See Advanced filtering, Aggregation & Summary and Boolean formatting. Explicit labels in aggregation items, card mappings, conditional badges and row actions are configuration content: supply the language-specific captions yourself without changing the underlying business values.

CSV and Excel

CSV exports raw values and current column titles, using UTF-8 BOM by default. It does not store worksheet direction, visual formatting or cell types; Excel import may interpret dates and numbers according to local settings. XLSX preserves supported typed values, writes a rightToLeft worksheet flag based on component direction, and uses Excel number formats rather than copying K2 display strings. DateTime with a timezone is exported as an Excel serial representing UTC; Excel serials have no timezone metadata. Summary and group labels may include configured text; do not expect automatic translation of sheet names or all export captions.

CSV opened in Excel with mixed Arabic and English values
Existing CSV test capture: Arabic characters are preserved alongside English data.

See CSV export and Native Excel export.

Changing language programmatically

The preferred approach is to choose the language before initialization and reload the form when the application culture changes. There is no dedicated setLanguage API. Refresh re-evaluates configuration, but existing rendered controls can retain cached labels or layout; do not promise seamless live language switching.

// Diagnostic experiment on a test form, not a full K2 culture switch.
const cfg = window.K2AdvancedGridsConfig;
cfg.localization = { ...cfg.localization, language: 'ar-SA' };
K2AdvancedGrids.instance.refresh();
// For a consistent production experience, persist the choice in your
// application and reload with the selected culture/configuration.

Validation checklist

Repeat the following in each target culture and K2 environment before rollout. These are recommended acceptance tests, not claims of a new Runtime certification.

ScenarioExpected check
Auto / explicit en / arCorrect filter captions, pagination arrows and Boolean labels after reload.
Custom dictionaryExact culture entry and fallback labels; unchanged interpolation tokens.
Native RTL hostStart/end pinning and reordering, horizontal scrolling, sticky headers and summary alignment.
Mixed dataArabic names remain legible; order IDs, signed amounts and mixed descriptions remain correct.
Typed filtersArabic digits, decimal separator, ISO dates and Boolean selection.
DateTime boundariesUTC / local midnight, relative date filters and export values.
Cards and row actionsDirection, configured labels, native K2 rules and correct record identity.
CSV / XLSXUnicode round trip, worksheet direction, native types and exported values.
PreferencesReopen under each language; check saved column keys, order, visibility and pinning.

Current limitations

Beta 1.0 is not a general-purpose internationalization framework. It does not translate K2 native controls, business data or configured captions; it does not convert calendars, guarantee arbitrary locale parsing, or provide complete third-language dictionaries. Full RTL behavior depends on native K2 layout and browser CSS. Existing screenshots verify mixed-language content, but this documentation release does not add a fresh end-to-end Arabic Runtime test. Validate the target form before production deployment.

Enlarged screenshot