Skip to content

Make TextBox placeholder translatable#1908

Merged
maan2003 merged 1 commit intolinebender:masterfrom
Swatinem:translatable-textbox-placeholder
Aug 15, 2021
Merged

Make TextBox placeholder translatable#1908
maan2003 merged 1 commit intolinebender:masterfrom
Swatinem:translatable-textbox-placeholder

Conversation

@Swatinem
Copy link
Contributor

This makes the TextBox placeholder a LabelText which can be initialized with a LocalizedString and thus translated.

The problem that I have is that the TextBox seems to be bound to a very specific editable text via lens, and that couples the LabelText to the same Data, which means I currently can’t use anything else from my main Data as placeholders of the LocalizedString (or Dynamic for that matter).

Copy link
Collaborator

@maan2003 maan2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@maan2003
Copy link
Collaborator

The problem that I have is that the TextBox seems to be bound to a very specific editable text via lens, and that couples the LabelText to the same Data, which means I currently can’t use anything else from my main Data as placeholders of the LocalizedString (or Dynamic for that matter).

that is a limitation of Lens. I don't think it is easily to fix

This makes the `TextBox` placeholder a `LabelText` which can be initialized with a `LocalizedString` and thus translated.

One limitation is that the `LabelText` is bound to the same `Data` type parameter as the lensed `TextBox`, so it is not possible currently to use translation parameters from the broader application state.
@Swatinem Swatinem force-pushed the translatable-textbox-placeholder branch from 639a2e5 to 69e480f Compare August 12, 2021 10:47
@Swatinem Swatinem changed the title WIP: Make TextBox placeholder translatable Make TextBox placeholder translatable Aug 12, 2021
@Swatinem Swatinem marked this pull request as ready for review August 12, 2021 10:47
@Swatinem
Copy link
Contributor Author

I noted down the limitations in the commit message, otherwise the code is unchanged and was just rebased on master.

@jneem
Copy link
Member

jneem commented Aug 14, 2021

This is good to go, right?

@Swatinem
Copy link
Contributor Author

@jneem yes, this should be good to go

@maan2003 maan2003 merged commit f053464 into linebender:master Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants