-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix empty string shown if company name is empty
If the company name is empty in the custom locales set in the web (as is the default), then the widgets tried to get it, but as it is empty, then the fallback was the theme and the configuration. If neither of those was able to provide a non-empty value, then the idea is to use the local fallback. However, for this I was mistakenly using the value from `Localizable.tr`. The problem is that this method first attempts to get it again from the string provider. As we determined in the first step, this is empty. However, `Localizable.tr` doesn't filter empty values, as all other strings can legitimately be empty. So the method returns empty string, and this is shown on the widgets. The solution was to create a new value in the SwiftGen stencil, which is called `companyNameLocalFallbackOnly`. As the name says, this variable sends the string provider as nil, thus ignoring the company name's empty value, and using the value in the `Localizable.strings`, or the hardcoded "Company Name" as fallback. For now, no other string is subject to this matter where the string can come from a lot of various sources, so this approach should be sufficient. If at some point it happens that quite a lot of strings need to be fetched from various sources, what can be done is that the stencil can be changed so that instead of generating `static let`s, we generate `static func`s, and then we can easily send the string provider as needed. MOB-2768
- Loading branch information
1 parent
df37271
commit 915fa92
Showing
5 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters