From 6f76ded3f5f7da72bbfd409701d3030ddfbb4ab6 Mon Sep 17 00:00:00 2001 From: Donald Chickeme Date: Mon, 19 Feb 2024 13:38:55 +0100 Subject: [PATCH 1/2] update readme with details of FormattedDeferredText --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index c33392c..d8ad5bc 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,18 @@ val deferredFormattedString: DeferredFormattedString = deferredFormattedPlurals. // If you have only the format args: val deferredPlurals: DeferredPlurals = deferredFormattedPlurals.withFormatArgs("million") ``` +#### Auxiliary type(s) +`FormattedDeferredText` is a type that wraps a `DeferredFormattedString`. This is useful for when +the format arguments are determined at the declaration site rather than the resolution site. + +```kotlin +val formattedString = DeferredFormattedString.Constant("%s and %s") +// Formatted text with arguments at resolution site +formattedString.resolve(context, "A", "B") + +// Formatted text with arguments at declaration site +FormattedDeferredText(formattedString, "A", "B").resolve(context) +``` All text-related types can eventually be converted to `DeferredText` through similar extensions. From e324266a8eaba106e6f1e37c83da8391f1909758 Mon Sep 17 00:00:00 2001 From: Donald Chickeme Date: Thu, 22 Feb 2024 17:02:02 +0100 Subject: [PATCH 2/2] adjust FormattedDeferredText description --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d8ad5bc..c918404 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,9 @@ val deferredFormattedString: DeferredFormattedString = deferredFormattedPlurals. val deferredPlurals: DeferredPlurals = deferredFormattedPlurals.withFormatArgs("million") ``` #### Auxiliary type(s) -`FormattedDeferredText` is a type that wraps a `DeferredFormattedString`. This is useful for when -the format arguments are determined at the declaration site rather than the resolution site. +`FormattedDeferredText` is a type that wraps a `DeferredFormattedString` and it's relevant +arguments. This is useful when the format arguments are determined at the declaration site rather +than the resolution site. ```kotlin val formattedString = DeferredFormattedString.Constant("%s and %s")