Skip to content

Conversation

@xgimp
Copy link

@xgimp xgimp commented Nov 17, 2025

I Added support for Altcha translations. Should resolve issue #22

I added ALTCHA_INCLUDE_TRANSLATIONS settings that is False by default. My thinking was that by default, you want to include as little javascript as posible.

Also if user provides his own ALTCHA_JS_URL he probably bundles translations he needs.

@xgimp xgimp marked this pull request as ready for review November 17, 2025 15:03
Signed-off-by: Lukáš Bačovský <l.bacovsky@gmail.com>
@xgimp xgimp force-pushed the feat/language-support branch from 9dfc83a to 8568025 Compare November 17, 2025 15:08
Signed-off-by: Lukáš Bačovský <l.bacovsky@gmail.com>
Signed-off-by: Lukáš Bačovský <l.bacovsky@gmail.com>
@tdruez
Copy link
Contributor

tdruez commented Nov 19, 2025

Hi @xgimp, thanks for reporting and looking into this.
Instead of a new setting, should we include the extra JS based on the presence of language argument when declaring the field, as in AltchaField(language="cs")?

@xgimp
Copy link
Author

xgimp commented Nov 19, 2025

Hello,

I was thinking, that in case when user provides his own ALTCHA_JS_URL with bundled or customized translations it could be accidently overrided or included twice, if we just load the translations based on the language argument.

for example:

ALTCHA_JS_URL = "myBundleWithCsLangIncluded.js"

class SomeForm(forms.Form):
    captcha_field = AltchaField(
        language="cs"
    )
<script async defer src="myBundleWithCsLangIncluded.js" type="module"></script>
<script async defer src="<'cs' languge included by us based on language parameter>" type="module"></script>
<!-- in this case the language is included twice -->
<altcha-widget>

So that is why I implemented the switch :-).

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.

2 participants