-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ottl/pkg] Add support for locale in the Time converter #35107
[ottl/pkg] Add support for locale in the Time converter #35107
Conversation
@@ -1519,6 +1519,16 @@ Examples: | |||
- `Time("2012-11-01T22:08:41+0000 EST", "%Y-%m-%dT%H:%M:%S%z %Z")` | |||
- `Time("2023-05-26 12:34:56", "%Y-%m-%d %H:%M:%S", "America/New_York")` | |||
|
|||
`locale` specifies the input language of the `target` value. It is used to interpret timestamp values written in a specific language, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add something that conveys that when not set english is the local that gets used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase
…lector-contrib into ottl_time_func_locale_support # Conflicts: # pkg/ottl/ottlfuncs/func_time.go
Hi @TylerHelmuth, I've rebased and adapted it to the latest changes to avoid parsing the c-time layout in every operation (#35129). Thanks! |
…ry#35107) **Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Added support for locale in the `Time` converter, so it can parse timestamps written in non-english languages. The new `locale` parameter's value is optional, and can be specified as: `Time("Febrero 25 lunes, 2002, 02:03:04 p.m.", "%B %d %A, %Y, %r", "America/New_York", "es-ES")` The value must be a well-formed BCP-47 language tag, and a known [CLDR](https://cldr.unicode.org) v45 locale. **Link to tracking Issue:** open-telemetry#32978 **Testing:** Unit tests **Documentation:** ottl/README was updated to include the new optional `locale` parameter.
Description:
Added support for locale in the
Time
converter, so it can parse timestamps written in non-english languages.The new
locale
parameter's value is optional, and can be specified as:Time("Febrero 25 lunes, 2002, 02:03:04 p.m.", "%B %d %A, %Y, %r", "America/New_York", "es-ES")
The value must be a well-formed BCP-47 language tag, and a known CLDR v45 locale.
Link to tracking Issue: #32978
Testing: Unit tests
Documentation: ottl/README was updated to include the new optional
locale
parameter.