gt-react 10.3.1 → 10.3.2-alpha.1

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/client.d.ts CHANGED
@@ -739,4 +739,41 @@ declare function useRegionSelector({ regions: _regions, customMapping, prioritiz
739
739
  */
740
740
  declare function useLocaleDirection(locale?: string): 'ltr' | 'rtl';
741
741
 
742
- export { Branch, ClientProvider, Currency, DateTime, GTContext, GTProvider, LocaleSelector, Num, Plural, RegionSelector, T, Var, renderVariable, useDefaultLocale, useGT, useGTClass, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useRegion, useRegionSelector, useRuntimeTranslation, useSetLocale, useTranslations };
742
+ declare class Msg {
743
+ /**
744
+ * Encodes content into a message that contains important translation metadata
745
+ * @param message The message to encode.
746
+ * @param options The options to encode.
747
+ * @returns The encoded message.
748
+ *
749
+ * @note - Message format
750
+ * A message is broken into two parts separated by colons:
751
+ * - interpolated content - the content with interpolated variables
752
+ * - hash + options - a unique identifier for the source content and options for the translation
753
+ *
754
+ * @example - Basic usage
755
+ *
756
+ * ```jsx
757
+ * import { Msg } from 'gt-react';
758
+ * const message = Msg.encode('Hello, {name}!', { name: 'Brian' });
759
+ * console.log(message); // "Hello, Brian:eyIiOiIweDEyMyIsIm5hbWUiOiJCcmlhbiJ9"
760
+ * ```
761
+ * eyIiOiIweDEyMyIsIm5hbWUiOiJCcmlhbiJ9 encodes to {"$hash": "0x123", "name": "Brian"}
762
+ *
763
+ */
764
+ static encode(content: string, options?: InlineTranslationOptions): string;
765
+ /**
766
+ * Extracts the original interpolated content from a message.
767
+ * @param message The message to decode.
768
+ * @returns The decoded message.
769
+ */
770
+ static decode(content: string): string;
771
+ /**
772
+ * Decodes the options from a message.
773
+ * @param content The message to decode.
774
+ * @returns The decoded options.
775
+ */
776
+ static decodeOptions(content: string): InlineTranslationOptions | null;
777
+ }
778
+
779
+ export { Branch, ClientProvider, Currency, DateTime, GTContext, GTProvider, LocaleSelector, Msg, Num, Plural, RegionSelector, T, Var, renderVariable, useDefaultLocale, useGT, useGTClass, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useRegion, useRegionSelector, useRuntimeTranslation, useSetLocale, useTranslations };
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,qBAAqB,MAAM,wCAAwC,CAAC;AAC3E,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAC9C,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,CAAC,MAAM,wBAAwB,CAAC;AACvC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B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