Skip to content

Commit

Permalink
update readme with details of FormattedDeferredText
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldchickeme committed Feb 19, 2024
1 parent e4ad4fc commit 6f76ded
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 6f76ded

Please sign in to comment.