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

Restrict Japanese to Residents of Japan #299

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions microsetta_interface/templates/account_details.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,32 @@
$("#state").empty();
}

// Special case to prevent users outside Japan from using Japanese as their language
$('#language').empty();
if (code == "JP") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "code" derived from language tag rather than country? Output on here is hard via phone :/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's the country that the user selects for their residence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

{% for lang_key in languages %}
var option = $('<option></option>')
.attr('value', '{{ languages[lang_key].value }}')
{% if account.language == languages[lang_key].value %}
.attr('selected', 'selected')
{% endif %}
.text('{{ languages[lang_key].display_text }}');
$('#language').append(option);
{% endfor %}
} else {
{% for lang_key in languages %}
{% if languages[lang_key].value != "ja_JP" %}
var option = $('<option></option>')
.attr('value', '{{ languages[lang_key].value }}')
{% if account.language == languages[lang_key].value %}
.attr('selected', 'selected')
{% endif %}
.text('{{ languages[lang_key].display_text }}');
$('#language').append(option);
{% endif %}
{% endfor %}
}

// special case the use of codes for US states
if (code == "US") {
for (var state of US_STATES)
Expand Down
Loading