Skip to main content

Utilities

Introduction

This module provides utility types and functions for working with help/documentation folders and locale-based file resolution.

Types

HelpFolderOptions

Options for resolving help folder and index file paths.

export type HelpFolderOptions = {
path: string;
folder?: string;
indexFile?: string;
useLocale?: boolean;
useLocaleAsPrefix?: boolean;
};
PropertyTypeDescription
pathstringThe base path for the help folder
folderstring?The name of the folder (optional)
indexFilestring?The name of the index file (optional)
useLocaleboolean?If true, the locale will be used to determine the folder to use (optional)
useLocaleAsPrefixboolean?If true, the locale will be used as a prefix for the help folder (optional)

Functions

getHelpIndexUrl

Resolves the help index file URL based on locale and options.

function getHelpIndexUrl(locale: string, options: HelpFolderOptions): string

Parameters

ParameterTypeDescription
localestringThe locale to use (e.g., 'en-US')
optionsHelpFolderOptionsOptions for folder and file resolution

Returns

TypeDescription
stringThe resolved help index file URL

Example

import { getHelpIndexUrl } from '@sinequa/atomic';

const url = getHelpIndexUrl('en-US', {
path: 'help',
folder: 'docs',
indexFile: 'index.html',
useLocale: true
});
// url: 'help/docs/en-US/index.html'