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

[BUG] Edirom fails when no edition lang is defined #441

Open
riedde opened this issue Oct 11, 2024 · 2 comments
Open

[BUG] Edirom fails when no edition lang is defined #441

riedde opened this issue Oct 11, 2024 · 2 comments

Comments

@riedde
Copy link
Contributor

riedde commented Oct 11, 2024

Describe the problem
When no default lang is defined in the data the edirom fails. I think the problem occurs here

declare function edition:getLanguageFileURI($uri as xs:string, $lang as xs:string) as xs:string {

To Reproduce
Delete the language from the preferences and/or the edirom-edition-file.

Expected behavior
If no lang is defined the edirom should use the default lang of the software (

<entry key="application_language" value="de"/>
). I remember, that we already fixed this but maybe not for this case.

Data
Use any data and play with the lang definition.

Edirom information

  • Version on develop (2024-10-11)

Environment information

  • Standard
@riedde riedde added this to the 1.0.0 milestone Oct 11, 2024
@riedde riedde self-assigned this Oct 11, 2024
@peterstadler
Copy link
Member

I think it's rather this function that should be fixed:

declare function eutil:getLanguage($edition as xs:string?) as xs:string {
if (request:get-parameter("lang", "") != "") then
request:get-parameter("lang", "")
else if(request:get-cookie-names() = 'edirom-language') then
request:get-cookie-value('edirom-language')
else
eutil:getPreference('application_language', edition:findEdition($edition))
};

… since eutil:getLanguage#1 might return an empty string.

My suggestion would be to hard code a default value as the last else case to make sure to always return something sensible.

When at it, I think we should modify this function to not only get but also set the language. Currently, this is only done at index.xql at

<set-header name="Set-Cookie" value="edirom-language={$langVal}" />

but I think we should be able to set the language more dynamically (without reloading the page).

@riedde
Copy link
Contributor Author

riedde commented Oct 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants