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

Proposal: add ThemePlugin function to access multilingual theme options #10616

Open
NateWr opened this issue Nov 15, 2024 · 2 comments
Open

Proposal: add ThemePlugin function to access multilingual theme options #10616

NateWr opened this issue Nov 15, 2024 · 2 comments

Comments

@NateWr
Copy link
Contributor

NateWr commented Nov 15, 2024

Describe the problem
It's cumbersome to access a multilingual theme option in a template. We have to assign it to a variable and then use the locale key to access it.

{assign var="titles" value=$activeTheme->getOption('title')}
{if $titles.$currentLocale}
  {$titles.$currentLocale}
{/if}

Describe the solution
Add a ThemePlugin helper function get a localized option value.

{if $activeTheme->getLocalizedOption('title')}
  {$activeTheme->getLocalizedOption('title')
{/if}

What application are you using?
I'm proposing to add this to OJS 3.3.

Additional information
I appreciate this is a very minor improvement. But it would align ThemePlugin::getOption() with similar data access objects. Not everyone knows that $currentLocale is available in templates.

@NateWr
Copy link
Contributor Author

NateWr commented Nov 15, 2024

Happy to forward port this if you like. But I can work around it if you don't want to add things like this to the LTS.

PRs:
#10617 (stable-3_3_0)

Tests:
pkp/ojs#4524 (stable-3_3_0)

@asmecher
Copy link
Member

@Godoy0722, I think you've run in to a need for this, if I remember right? Could you have a look?

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

2 participants