Skip to content
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

Test if a translation is 'currently' available and/or a method to test for blankness #25

Open
josephwright opened this issue Jul 23, 2023 · 1 comment

Comments

@josephwright
Copy link

The current \IfTranslation requires we know the current language. \GetTranslation does not work cleanly inside an f-type expansion and I don't think uses \unexpanded around the 'payload'. Thus there is no obvious way to do something like 'check if translating this string will give some tokens of output', as we can't do

\IfTranslationAlt{<string>}{\GetTranslation{<string>}}

or

\expanded{\noexpand\ifblank{\GetTranslation{<string>}}

I need this for addressing josephwright/siunitx#650: in Italian, I need a translation to show up that will be absent in English, so I need to know if there is a translation to handle spacing.

I guess the easiest for me would be '\IfTranslation*, which would not need the language string but would use the current language.

@josephwright
Copy link
Author

Something as simple as

\newcommand*\IfTranslationAvailable[1]{%
  \expanded{%
    \noexpand\@trnslt@if@translation
      {\unexpanded{#1}}
      {\@trnslt@current@language}%
  }%
}

would cover my use case if it is acceptable.

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

No branches or pull requests

1 participant