-
Notifications
You must be signed in to change notification settings - Fork 551
[WIP] Strings Localization + Spanish/French translations #13538
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
base: master
Are you sure you want to change the base?
Conversation
lontivero
left a comment
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.
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), |
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.
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.
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.
This change is only to avoid a warning but I agree with you
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.
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) + "%"; |
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.
We will have a lot of fun translating this to Arabic.
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.
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 |
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.
This text helper is not very good
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.
I would prefer not to change anything functional in this PR if possible
|
|
||
| private AddedWalletPageViewModel(IWalletSettingsModel walletSettings, WalletCreationOptions options) | ||
| { | ||
| Title = Lang.Resources.AddedWalletPageViewModel_Title; |
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.
This looks wrong to me. We should use the NavigationMetaData attribute as before but instad of using "Success", use "AddedWalletPageViewModel_Title"
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.
An attribute argument must be a constant expression, 'typeof()' expression or array creation expression of an attribute parameter type
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.
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
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