Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@w-ahmad
Copy link
Owner

@w-ahmad w-ahmad commented Feb 20, 2025

Description

This PR introduces localization support for WinUI.TableView, allowing users to add resource files for their desired languages. This was a long-awaited enhancement request, and it is now implemented.

  • Added support for localization using .resw files.
  • Users can now add a resource file named WinUI.TableView.resw under Strings/{language name}/.
  • Set desired language to Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride

Sample resources:

Name en-US
BlankFilterValue (Blank)
Cancel Cancel
ClearFilter Clear Filter
ClearSorting Clear Sorting
Copy Copy
CopyCommandDescription Copy the selected row's content to clipboard.
CopyWithHeaders Copy with Headers
CopyWithHeadersCommandDescription Copy the selected row's content including column headers to clipboard.
DatePickerPlaceholder Pick a date
DeselectAll Deselect All
DeselectAllCommandDescription Deselect all rows.
ExportAll Export All to CSV
ExportSelected Export Selected to CSV
Ok Ok
SearchBoxPlaceholder Search...
SelectAll Select All
SelectAllCommandDescription Select all rows.
SelectAllParenthesized (Select All)
SortAscending Sort Ascending
SortDescending Sort Descending
TimePickerPlaceholder Pick a time

This was linked to issues Feb 20, 2025
Copy link
Contributor

@VisualAlf VisualAlf left a comment

Choose a reason for hiding this comment

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

very clean design !!

some minor flaws:

TableViewDateColumn:
Line 67: this always stays as 'pick a date'. since the DP has a default. Consider dropping the DependencyProp.

TableViewColumnHeader.xaml:
Line 158: remove PlaceholderText in Autosuggestbox, since set in code.

TableViewTimeColumn:
missing Placeholder setter for TimePickerControl

TableViewTimePicker:
consider dropping PlaceHolder DP

TableViewColumnHeader:
consider dropping Descriptions for 'SelectAll', 'DeselectAll', 'Copy', and 'CopyWithHeaders', since they are sort of redundant, and well described in the command.

TableViewLocalizedStrings.GetValue(string name)
I don't understand why you need TryGetValue(..) and then GetValue(..) if first returns null ??

@Bush-cat
Copy link

Very nice Implementation, I shortly tested it in my Application and it was working well.

I have some suggestions, since we don't have many strings, why not add strings for all Languages into the Library by doing community translations, there are many free services that generate resx files from user inputs, users can review changes made by others and submit new translations. Or we could start with sample machine translations.
Here is an Example of how it could look with an existing project
https://crowdin.com/project/Evolution_X/de

@w-ahmad
Copy link
Owner Author

w-ahmad commented Feb 21, 2025

Very nice Implementation, I shortly tested it in my Application and it was working well.

I have some suggestions, since we don't have many strings, why not add strings for all Languages into the Library by doing community translations, there are many free services that generate resx files from user inputs, users can review changes made by others and submit new translations. Or we could start with sample machine translations. Here is an Example of how it could look with an existing project https://crowdin.com/project/Evolution_X/de

@Bush-cat Thanks for your suggestion! I completely agree that having translations for all languages would be great. For now instead of using Crowdin, I’d prefer to accept translation contributions directly on GitHub. Feel free to open a PR with your own language translations—we’d really appreciate it!

@w-ahmad
Copy link
Owner Author

w-ahmad commented Feb 21, 2025

very clean design !!

some minor flaws:

TableViewDateColumn: Line 67: this always stays as 'pick a date'. since the DP has a default. Consider dropping the DependencyProp.

TableViewColumnHeader.xaml: Line 158: remove PlaceholderText in Autosuggestbox, since set in code.

TableViewTimeColumn: missing Placeholder setter for TimePickerControl

TableViewTimePicker: consider dropping PlaceHolder DP

TableViewColumnHeader: consider dropping Descriptions for 'SelectAll', 'DeselectAll', 'Copy', and 'CopyWithHeaders', since they are sort of redundant, and well described in the command.

TableViewLocalizedStrings.GetValue(string name) I don't understand why you need TryGetValue(..) and then GetValue(..) if first returns null ??

Thank you, @VisualAlf! I've made the changes and am merging the PR now. Regarding the descriptions, they are just tooltips for the menu items. As for your last point about TryGetValue, the reason for that is if the resource isn't found, the next line ensures it falls back to the default language resource.

@w-ahmad w-ahmad merged commit b4659c1 into main Feb 21, 2025
1 check passed
@w-ahmad w-ahmad deleted the Localization branch February 21, 2025 21:06
@VisualAlf VisualAlf mentioned this pull request Mar 13, 2025
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.

Localization Support 2 (see also #9) Localization Support

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.