@dxtmisha/functional-basic 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.d.ts CHANGED
@@ -5671,6 +5671,7 @@ export declare class Translate {
5671
5671
  protected static cache: string[];
5672
5672
  protected static resolveList: (() => void)[];
5673
5673
  protected static timeout?: any;
5674
+ protected static isReadApi: boolean;
5674
5675
  /**
5675
5676
  * Getting the translation text by its code.
5676
5677
  *
@@ -5734,6 +5735,13 @@ export declare class Translate {
5734
5735
  * @param data list of texts by location/ список текстов по местоположению
5735
5736
  */
5736
5737
  static addSyncByLocation(data: Record<string, Record<string, string>>): void;
5738
+ /**
5739
+ * Adds texts synchronously from the file.
5740
+ *
5741
+ * Добавляет тексты синхронно из файла.
5742
+ * @param data file with translations/ файл с переводами
5743
+ */
5744
+ static addSyncByFile(data: TranslateDataFile): void;
5737
5745
  /**
5738
5746
  * Change the path to the script for obtaining the translation.
5739
5747
  *
@@ -5741,7 +5749,20 @@ export declare class Translate {
5741
5749
  * @param url path to the script/ путь к скрипту
5742
5750
  */
5743
5751
  static setUrl(url: string): Translate;
5752
+ /**
5753
+ * Change the name of the property to get the translation.
5754
+ *
5755
+ * Изменить имя свойства для получения перевода.
5756
+ * @param name property name/ имя свойства
5757
+ */
5744
5758
  static setPropsName(name: string): Translate;
5759
+ /**
5760
+ * Change the read mode from the API.
5761
+ *
5762
+ * Изменить режим чтения из API.
5763
+ * @param value read mode/ режим чтения
5764
+ */
5765
+ static setReadApi(value: boolean): Translate;
5745
5766
  /**
5746
5767
  * Checks for translation by code, taking into account fallback options.
5747
5768
  *
@@ -5804,14 +5825,112 @@ export declare class Translate {
5804
5825
  * Добавление данных по переводу с сервера.
5805
5826
  */
5806
5827
  protected static make(): Promise<void>;
5828
+ /**
5829
+ * Adding translation data from the list.
5830
+ *
5831
+ * Добавление данных по переводу из списка.
5832
+ * @param list list of translations/ список переводов
5833
+ */
5834
+ protected static makeList(list: Record<string, string>): void;
5807
5835
  }
5808
5836
 
5837
+ /**
5838
+ * Prefix for global translations.
5839
+ * Префикс для глобальных переводов.
5840
+ */
5809
5841
  export declare const TRANSLATE_GLOBAL_PREFIX = "global";
5810
5842
 
5843
+ /**
5844
+ * Request timeout for batch loading (ms).
5845
+ * Таймаут запроса для пакетной загрузки (мс).
5846
+ */
5847
+ export declare const TRANSLATE_TIME_OUT = 320;
5848
+
5849
+ /**
5850
+ * Translation code or a list of translation codes for template replacement.
5851
+ * Код перевода или список кодов для замены шаблона.
5852
+ */
5811
5853
  export declare type TranslateCode = string | string[];
5812
5854
 
5855
+ /**
5856
+ * A mapping of locale strings to their respective translation file loaders.
5857
+ * Сопоставление строк локалей и соответствующих им загрузчиков файлов перевода.
5858
+ */
5859
+ export declare type TranslateDataFile = Record<string, TranslateDataFileItem>;
5860
+
5861
+ /**
5862
+ * Asynchronous loader function for a translation file.
5863
+ * Асинхронная функция-загрузчик для файла перевода.
5864
+ */
5865
+ export declare type TranslateDataFileItem = () => Promise<TranslateDataFileList>;
5866
+
5867
+ /**
5868
+ * A simple key-value record of translations from a file.
5869
+ * Простой рекорд «ключ-значение» с переводами из файла.
5870
+ */
5871
+ export declare type TranslateDataFileList = Record<string, string>;
5872
+
5873
+ /**
5874
+ * Class for working with translation files.
5875
+ *
5876
+ * Класс для работы с файлами перевода.
5877
+ */
5878
+ export declare class TranslateFile {
5879
+ /** List of files with translations/ Список файлов с переводами */
5880
+ protected static files: TranslateDataFile;
5881
+ /** Data from files/ Данные из файлов */
5882
+ protected static data: Record<string, TranslateDataFileList>;
5883
+ /**
5884
+ * Checks if there are files for the current location.
5885
+ *
5886
+ * Проверяет, есть ли файлы для текущего местоположения.
5887
+ */
5888
+ static isFile(): boolean;
5889
+ /**
5890
+ * Returns a list of translations from the file for the current location.
5891
+ *
5892
+ * Возвращает список переводов из файла для текущего местоположения.
5893
+ */
5894
+ static getList(): Promise<TranslateDataFileList | undefined>;
5895
+ /**
5896
+ * Adds a list of files with translations.
5897
+ *
5898
+ * Добавляет список файлов с переводами.
5899
+ * @param data list of files/ список файлов
5900
+ */
5901
+ static add(data: TranslateDataFile): void;
5902
+ /**
5903
+ * Returns the key for the current location from the list of files.
5904
+ *
5905
+ * Возвращает ключ для текущего местоположения из списка файлов.
5906
+ */
5907
+ protected static getIndex(): string | undefined;
5908
+ /**
5909
+ * Returns a list of translations from the cache.
5910
+ *
5911
+ * Возвращает список переводов из кэша.
5912
+ * @param index file key/ ключ файла
5913
+ */
5914
+ protected static getByData(index: string): TranslateDataFileList | undefined;
5915
+ /**
5916
+ * Returns a list of translations from the file and caches the result.
5917
+ *
5918
+ * Возвращает список переводов из файла и кэширует результат.
5919
+ * @param index file key/ ключ файла
5920
+ */
5921
+ protected static getByFile(index: string): Promise<TranslateDataFileList | undefined>;
5922
+ }
5923
+
5924
+ /**
5925
+ * Return type for translation retrieval: an object if a list was requested, or a string for a single key.
5926
+ * Тип возвращаемого значения для получения перевода: объект, если был запрошен список, или строка для одного ключа.
5927
+ */
5813
5928
  export declare type TranslateItemOrList<T extends TranslateCode> = T extends string[] ? TranslateList<T> : string;
5814
5929
 
5930
+ /**
5931
+ * Object with translated strings, where the keys are the names of the translation codes.
5932
+ * Объект с переведенными строками, где ключи — имена кодов переводов.
5933
+ */
5815
5934
  export declare type TranslateList<T extends TranslateCode[]> = {
5816
5935
  [K in T[number] as K extends readonly string[] ? K[0] : K]: string;
5817
5936
  };