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

fix: "uninitialized" warning in the user form for professional accounts #6637

Merged
merged 6 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
45 changes: 22 additions & 23 deletions cgi/user.pl
Original file line number Diff line number Diff line change
Expand Up @@ -196,29 +196,28 @@

# Professional account
push @{$template_data_ref->{sections}}, {
id => "professional",
name => lang("pro_account"),
description => "if_you_work_for_a_producer",
note => "producers_platform_description_long",
fields => [
{
field => "pro",
type => "checkbox",
label => lang("this_is_a_pro_account"),
warning => sprintf(lang("this_is_a_pro_account_for_org"),"<b>" . $user_ref->{org} . "</b>"),
value => "off",
},
{
field => "pro_checkbox",
type => "hidden",
value => 1,
},
{
field => "requested_org",
label => lang("producer_or_brand") . ":",
}
]
};
id => "professional",
yuktea marked this conversation as resolved.
Show resolved Hide resolved
name => lang("pro_account"),
description => "if_you_work_for_a_producer",
note => "producers_platform_description_long",
fields => [
{
field => "pro",
type => "checkbox",
label => lang("this_is_a_pro_account"),
value => "off",
},
{
field => "pro_checkbox",
type => "hidden",
value => 1,
},
{
field => "requested_org",
label => lang("producer_or_brand") . ":",
}
]
};

# Teams section
# Do not display teams if it is a professional account
Expand Down
4 changes: 2 additions & 2 deletions templates/web/pages/user_form/user_form_page.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<label for="[% field.field %]"> [% field.label %]</label>
<input type="email" id="[% field.field %]" name="[% field.field %]" value = "[% field.value %]" autocomplete="email"/>
[% ELSIF field.type == 'checkbox' %]
[% IF accepted_organization && section.id == "professional" %]
<p>[% field.warning %]</p>
[% IF accepted_organization && section.id == "professional" && user_org.defined %]
<p>[% f_lang('this_is_a_pro_account_for_org', {'org' => user_org} ) %]</p>
Copy link
Contributor

@stephanegigandet stephanegigandet Apr 18, 2022

Choose a reason for hiding this comment

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

Hi @yuktea , have you checked if it works? (you can do that by creating an account with the "this is a professional account" checkbox, and then editing the account).
I think it won't work as is, because f_lang() expects a different format than sprintf (%s vs something like ).
You can look at the strings in po/common/common.pot and po/common.en.po
The best solution is indeed to use f_lang(), but then you have to change the string.

e.g. here is an example for another string:

# variable names between { } must not be translated
msgctxt "f_move_data_and_photos_to_main_language"
msgid "Move all data and selected photos in {language} to the main language of the product: {main_language}"
msgstr "Move all data and selected photos in {language} to the main language of the product: {main_language}"

[% ELSE %]
<label for="[% field.field %]">
<input type="checkbox" id="[% field.field %]" name="[% field.field %]" [% IF field.value == 'on' %]checked="checked"[% END %] />
Expand Down