Skip to content

Conversation

scottmakestech
Copy link
Collaborator

Per #1876:

  1. Fixes the Annual Report PDF link
  2. Sponsor logos now cannot extend outside their container
  3. All fallback strings for the animated sentences on the homepage: the hero, and the global impact section

…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") }}
Copy link
Contributor

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") }}
Copy link
Contributor

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:

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") }}

@bdaehlie
Copy link
Contributor

@scottmakestech What's the status of this PR?

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.

3 participants