Skip to content

Commit

Permalink
Add HasMessage function for Bundle (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
kellpossible authored Jun 13, 2024
1 parent 914fd90 commit a11a6bb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fluent/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,8 @@ func (bundle *Bundle) FormatMessage(key string, contexts ...*FormatContext) (str
result := res.resolvePattern(msg.Value).String()
return result, res.errors, nil
}

// Checks whether the bundle contains a message with the given key.
func (bundle *Bundle) HasMessage(key string) bool {
return bundle.messages[key] != nil
}

0 comments on commit a11a6bb

Please sign in to comment.