Open
Conversation
…ctions, which use html to animate specific parts of the sentence. If all of the parts needed for the animated sentence are not found, it will fallback to use the plain full sentence.
b9a1
suggested changes
Mar 26, 2025
| </h1> | ||
| <h2 class="text-2xl md:text-3xl font-bold mb-6 text-balance"> | ||
| {{ T "home_hero_nonprofit_prefix" }} <span class="relative inline-block"><span class="invisible text-4xl">{{ T "home_hero_certificate_count" }}</span><span id="certificate-count" class="text-4xl absolute left-0">{{ T "home_hero_certificate_count" }}</span></span> {{ T "home_hero_nonprofit_suffix" }}. | ||
| {{ if and (T "home_hero_nonprofit_prefix") (T "home_hero_certificate_count") (T "home_hero_nonprofit_suffix") }} |
Contributor
There was a problem hiding this comment.
It seems both Crowdin and the T function of Hugo return the English text as a fallback, so this condition will always be true. What about doing something like this instead:
<h2 class="text-2xl md:text-3xl font-bold mb-6 text-balance">
{{ $count := (T "home_hero_certificate_count") }}
{{ if findRE `^\d+M$` $count }}
{{ $count = printf `<span class="relative inline-block"><span class="invisible text-4xl">%[1]s</span><span id="certificate-count" class="text-4xl absolute left-0">%[1]s</span></span>` $count }}
{{ end }}
{{ replace (T "home_hero_nonprofit_sentence") "###" $count | safeHTML }}
</h2>This also removes the need for home_hero_nonprofit_prefix and home_hero_nonprofit_suffix.
| data-word2="{{ i18n "support_heading_word2" }}" | ||
| data-word3="{{ i18n "support_heading_word3" }}" | ||
| data-word4="{{ i18n "support_heading_word4" }}">{{ i18n "support_heading_word1" }}</span> | ||
| {{ if and (i18n "support_heading_base") (i18n "support_heading_word1") (i18n "support_heading_word2") (i18n "support_heading_word3") (i18n "support_heading_word4") }} |
Contributor
There was a problem hiding this comment.
Similarly always true. How about:
Suggested change
| {{ if and (i18n "support_heading_base") (i18n "support_heading_word1") (i18n "support_heading_word2") (i18n "support_heading_word3") (i18n "support_heading_word4") }} | |
| {{ if hasPrefix (i18n "support_heading_entire_sentence") (i18n "support_heading_base") }} |
Contributor
|
@scottmakestech What's the status of this PR? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per #1876: