Skip to content
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

CA-386317: Add localization support for data-source descriptions #3262

Conversation

danilo-delbusso
Copy link
Member

Also contains cleanup. In general, I tried to only have one method to override data source names, so it's in Helpers.

…code

- Make `friendlyName` a public filed, and update `ToString()` to use it
- Update constructor to take a description string
- Improve variable naming
- Remove `FriendlyName` from `DataPlot` and instead use helper method to fetch friendly names

Signed-off-by: Danilo Del Busso <[email protected]>
switch (originalId)
{
case "memory_free_kib":
return "memory_used_kib";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these are the wrong way around

Copy link
Member Author

Choose a reason for hiding this comment

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

The original was performing the same overrides, unless I'm missing something :/

memory_free_kib 👉 memory_used_kib
memory_internal_free 👉 memory_internal_used

if (dataSource.name_label == "memory_free_kib" && xenObject is Host)
                    friendlyName = Helpers.GetFriendlyDataSourceName("memory_used_kib", xenObject);
                else if (dataSource.name_label == "memory_internal_free" && xenObject is VM)
                    friendlyName = Helpers.GetFriendlyDataSourceName("memory_internal_used", xenObject);
                else
                    friendlyName = Helpers.GetFriendlyDataSourceName(dataSource.name_label, xenObject);

and

if (datasourceName == "memory_free_kib")
                FriendlyName = Helpers.GetFriendlyDataSourceName("memory_used_kib", xo);
            else if (datasourceName == "memory_internal_free")
                FriendlyName = Helpers.GetFriendlyDataSourceName("memory_internal_used", xo);
            else
                FriendlyName = Helpers.GetFriendlyDataSourceName(datasourceName, xo);

@CitrixChris CitrixChris added needs updating A reviewer has requested changes needs answer PR contains question that needs to be answered labels Dec 4, 2023
@danilo-delbusso danilo-delbusso removed the needs updating A reviewer has requested changes label Dec 5, 2023
@danilo-delbusso danilo-delbusso added answered All PR questions have been answered and removed needs answer PR contains question that needs to be answered labels Dec 5, 2023
@danilo-delbusso danilo-delbusso deleted the bug/datasource-description_CA-386317 branch December 6, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered All PR questions have been answered
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants