Skip to main content
Version: Next 🚧

Help Resources

This module provides utilities for resolving locale-aware help file URLs. It is useful for applications that serve their help documentation in multiple languages.

Types​

HelpFolderOptions​

Options for resolving the help folder and index file path.

type HelpFolderOptions = {
path: string;
folder?: string;
indexFile?: string;
useLocale?: boolean;
useLocaleAsPrefix?: boolean;
};
PropertyTypeRequiredDescription
pathstring✓Base path for the help folder
folderstringSubfolder name
indexFilestringName of the help index file
useLocalebooleanIf true, prefix the file path with the locale (e.g. en-US/)
useLocaleAsPrefixbooleanIf true, prefix the filename with the locale (e.g. en-US.index.html)

Functions​

getHelpIndexUrl()​

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

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

Parameters

ParameterTypeRequiredDescription
localestring✓BCP 47 locale code (e.g. 'en-US')
optionsHelpFolderOptions✓Folder and file resolution options

Returns string — resolved URL path to the help index file.

Example

get-help-index-url.ts
import { getHelpIndexUrl } from '@sinequa/atomic';

// With locale as folder prefix
getHelpIndexUrl('en-US', {
path: 'help',
folder: 'docs',
indexFile: 'index.html',
useLocale: true
});
// 'help/docs/en-US/index.html'

// With locale as filename prefix
getHelpIndexUrl('fr-FR', {
path: 'help',
indexFile: 'index.html',
useLocaleAsPrefix: true
});
// 'help/fr-FR.index.html'