Skip to content

Commit

Permalink
Update ReadMe with details of FormattedDeferredText (#99)
Browse files Browse the repository at this point in the history
* update readme with details of FormattedDeferredText

* adjust FormattedDeferredText description
  • Loading branch information
donaldchickeme authored Feb 28, 2024
1 parent e4ad4fc commit ee310f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ 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` 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")
// 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.

Expand Down

0 comments on commit ee310f8

Please sign in to comment.