Skip to content

Conversation

@turbolay
Copy link
Collaborator

@turbolay turbolay commented Oct 28, 2024

This first part includes the base of the code to handle localization + the localization of all ViewModels.
It therefore misses the localization of all Views + translation to French + translation to Spanish

While I used the code made on a fork as an inspiration, it is rebuilt from scratch because I was not satisfied with their implementation.

If this PR works correctly then there are no changes at all, except few english correction while I was noticing it and a list at software install that only contains English

@turbolay turbolay marked this pull request as draft October 28, 2024 01:44
Copy link
Collaborator

@lontivero lontivero left a comment

Choose a reason for hiding this comment

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

Wow, what a huge work! I will take a look next week by sure. Here just a very few comments:

["onionService"] = Global.OnionServiceUri?.ToString() ?? "Unavailable",
["backendStatus"] = sync.BackendStatus == BackendStatus.Connected ? "Connected" : "Disconnected",
["bestBlockchainHeight"] = smartHeaderChain.TipHeight.ToString(),
["bestBlockchainHeight"] = smartHeaderChain.TipHeight.ToString(CultureInfo.InvariantCulture),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sooner or later we will make a huge mistake with the RPC and multiple cultures. I suggest to use Invariant Culture in the JsonSerializerSettings DefaultSettings to make sure we never serialize anything with the local culture.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change is only to avoid a warning but I agree with you

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change is required to fix a warning. I've added the change you suggested, however I think that the only way to avoid any mistake is to delete all ToString() from this class and instead rely exclusively on the JsonConverter

{
var threshold = n > 0 ? "+" + precision : "-" + precision;
return "less than " + threshold.ToString(CultureInfo.InvariantCulture) + "%";
return $"{Lang.Resources.Sentences_less_than} " + threshold.ToString(CultureInfo.InvariantCulture) + "%";
Copy link
Collaborator

Choose a reason for hiding this comment

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

We will have a lot of fun translating this to Arabic.

Copy link
Collaborator Author

@turbolay turbolay Oct 28, 2024

Choose a reason for hiding this comment

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

This translation implementation is in fact less than 50% of the work it would require to translate to non-western languages. There are many other considerations that this PR doesn't handle such as number culture and all this kind of stuff.

Because translating to languages we don't know will not happen anytime soon, I suggest to ignore it. All what is done goes into the right direction to translate to any language anyway, even if it's not complete


namespace WalletWasabi.Fluent.Helpers;

public static partial class TextHelpers
Copy link
Collaborator

Choose a reason for hiding this comment

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

This text helper is not very good

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would prefer not to change anything functional in this PR if possible


private AddedWalletPageViewModel(IWalletSettingsModel walletSettings, WalletCreationOptions options)
{
Title = Lang.Resources.AddedWalletPageViewModel_Title;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks wrong to me. We should use the NavigationMetaData attribute as before but instad of using "Success", use "AddedWalletPageViewModel_Title"

Copy link
Collaborator Author

@turbolay turbolay Oct 28, 2024

Choose a reason for hiding this comment

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

An attribute argument must be a constant expression, 'typeof()' expression or array creation expression of an attribute parameter type

Copy link
Collaborator Author

@turbolay turbolay Oct 28, 2024

Choose a reason for hiding this comment

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

What I can do is remove the concept of Non Localized view models and instead make all Title, Caption implicit and only be visible in the resx file, like it's the case when IsLocalized = true

# Conflicts:
#	WalletWasabi.Fluent/ViewModels/Dialogs/Announcement/AnnouncementBase.cs
#	WalletWasabi.Fluent/ViewModels/Wallets/Buy/BuyViewModel.cs
#	WalletWasabi.Fluent/ViewModels/Wallets/Buy/Dialogs/ConfirmDeleteOrderDialogViewModel.cs
#	WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
#	WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
#	WalletWasabi/Rpc/JsonRpcRequestHandler.cs
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.

2 participants