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

Using Fluent with Organizations and Groups #34

Open
ryangermann-gov-on-ca opened this issue Aug 6, 2020 · 7 comments
Open

Using Fluent with Organizations and Groups #34

ryangermann-gov-on-ca opened this issue Aug 6, 2020 · 7 comments

Comments

@ryangermann-gov-on-ca
Copy link

I've had success with configuring Fluent for Datasets, but for Organizations / Groups, I can configure Fluent to work so that the form fields are presented for the two languages, but the entered data doesn't seem to be stored and when viewing the list of Datasets, only the english is shown (but in the Dataset info, the changing the site language works as expected, for both the Dataset and Resource information)

I've attached some screenshots hoping there is a bit more info on configuring Fluent for use with Organizations / Groups (for the purposes of our system, we,ve just changed the strings to "Ministries" and "Categories" but only the text labels have changed, no code changes underneath)

1: text entered in “EN Titre” and “FR Titre” isn’t saved, isn’t shown when the “Edit” screen is visited again, and note that the text and Ministry name on the left is in English only (perhaps an artefact of the En and FR title text not being saved?

fluent1

2: The list of Datasets (which have relabeled “Form Profiles”) is also only shown in English, even though the bilingual text shows on the “Form Profile” (dataset) page just fine. See two screenshots below:

Datasets list:
fluent2

Individual dataset ("Form Profile") screen in French, but showing Organization profile in English:
fluent3

the "Info Additionelle" section of the screen shows fine in French
fluent4

...and also the Dataset ("Form Profile") dataset and resource metadata shown in English, working as expected:
fluent5

so if there are aspects to configuring Fluent to work with Organizations and Groups that I'm not aware of, I'd appreciate it if someone could point me in the right direction. I'm not really skilled in Python development, so if there is custom coding required, I'll have to consult my colleagues to see who might be able to help out... any help would be appreciated.

@wardi
Copy link
Contributor

wardi commented Aug 7, 2020

Would you post a link to your theme extension and its group/organization schemas?

@boykoc
Copy link

boykoc commented Aug 7, 2020

Here is a basic PR that might help as an example of adding organizations in with scheming and fluent. It does a little extra modification to some templates but the PR message helps explain.

I agree, seeing your schema and extension would help troubleshoot what's causing the issue.

@ryangermann-gov-on-ca
Copy link
Author

Working with the PR mentioned

@ryangermann-gov-on-ca
Copy link
Author

@ryangermann-gov-on-ca
Copy link
Author

I've dropped in my Scheming config files, if someone could take a look at them I'd appreciate it. I'm also seeing when I click on the "Datasets" button, the list of datasets shows only the English, but when I access the dataset page it shows the French: am I missing a snippet from the Scheming extension?

@JVickery-TBS
Copy link
Contributor

Bump.

I am also able to use fluent and scheming extensions to get some translations for groups and organizations. They save in the database and have the correct output and validator snippets to display the data. However, the expected translated values still do not display in many places. E.g. group.read, breadcrumbs, dataset.read, etc.

It seems that CKAN uses the group and org definition of display_name throughout the code and templates. (https://github.com/ckan/ckan/blob/master/ckan/model/group.py#L165)

    @property
    def display_name(self) -> str:
        if self.title is not None and len(self.title):
            return self.title
        else:
            return self.name

I believe this is because the Group/Org title by default is not required. So CKAN uses display_name to fallback to the name/url of the group.

There are pluggable places to override this, but discussing with the ckan devs, translatable things should be accomplished at the template/view layer: https://docs.ckan.org/en/2.9/contributing/architecture.html

So we should not do this at the action level, we would be looking at the view level. Sadly, I cannot really find a place to do this easily in the view methods. Thus, you would have to have an extension that either extends the view functions, or (probably more accurately), just extends all of the templates to instead not access the display_name key on the group dicts.

@wardi
Copy link
Contributor

wardi commented Mar 10, 2023

These should be fixed in core the same way they were for datasets: add calls to get_translated in the right templates

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

4 participants