-
Notifications
You must be signed in to change notification settings - Fork 581
Fix Issue 1876 #1877
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: main
Are you sure you want to change the base?
Fix Issue 1876 #1877
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.
</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") }} |
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.
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") }} |
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.
Similarly always true. How about:
{{ 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") }} |
@scottmakestech What's the status of this PR? |
Per #1876: