culturecreates / artsdata-shortcode

Wordpress plugin for Artsdata
0 stars 1 forks source link

Biography in French profile displayed in English #25

Closed fjjulien closed 11 months ago

fjjulien commented 1 year ago

English profiles of individual members are looking fine: https://test.capacoa.ca/en/member/directory/profile/?uri=http://kg.artsdata.ca/resource/K14-139

French profiles of individual members are almost perfect too, except for the fact that the biography text is in English : https://test.capacoa.ca/fr/membre/repertoire/profil/?uri=http://kg.artsdata.ca/resource/K14-139

@dugost The translations of wp_users descriptions are handled by the Polylang plugin, aren't they? Can you please check that this translation is being extracted and loaded to Artsdata?

Once you are confident that the translation strings are extracted, please pass this issue on to Gregory so he can resolve it.

dugost commented 1 year ago

@fjjulien Yes, the meta_key "description" used for user "Biographical Info" has an alternate version "description_fr" created by Polylang.

As the staging membership doesn't include Rhodnie as a member, changes to his profile must be done on the production side. There I see a FR bio is included in his usermeta > description_fr, and entries also exist for your bio and Richard's. So AD is either not set up to pull content from the FR field or may simply be referencing the EN field when on the FR side. I'm unable to tell from looking at the code in v.1.4.3.

There's a PR for the usermeta plugin which includes the addition of "description_fr". But the FR bio doesn't appear even after I manually added that field to the staging plugin as a test.

@saumier I don't think that PR will resolve the issue so any idea where the issue could lie?

saumier commented 1 year ago

@dugost @fjjulien The french description is not showing in the Wordpress Users API.

I looked at both www.capacoa.ca and in test.capacoa.ca for any 'description_fr' fields and found none for any user (even test user "Ryan13".)

@dugost I made an official release of the usermeta plugin. https://github.com/culturecreates/capacoa-artsdata-usermeta/releases/tag/v2.1.0

There is no point in doing anything further with the shortcode plugin or Artsdata until the description_fr appears when you call the Wordpress User API in test or production.

For me to continue the "description_fr" must appear in one of these pages: https://test.capacoa.ca/wp-json/wp/v2/users?per_page=100 https://www.capacoa.ca/wp-json/wp/v2/users?per_page=100&page=1 https://www.capacoa.ca/wp-json/wp/v2/users?per_page=100&page=2

@dugost I'll need your help as this is internal to the way the forms collect "description_fr" and store it in a Wordpress database field. I don't know how that works. If you can find a way to add the missing description in french to the Wordpress Users API then I can take it from there.

 {
    "id": 150,
    "name": "Rhodnie Désir",
    "url": "",
    "description": "Rhodnie Désir has created about fifteen choreographic works. Her flagship piece BOW'T TRAIL Retrospek and her pioneering memoir journey BOW 'T TRAIL have earned her two awards from the Prix de la danse de Montréal (2020): The Prix Envol and the highly coveted Grand Prix de la danse.",
    "link": "https://capacoa.ca/author/rd-creations/",
    "slug": "rd-creations",
    "avatar_urls": {
      "24": "https://secure.gravatar.com/avatar/44e30447ae4f8319e312388dd736c266?s=24&d=mm&r=g",
      "48": "https://secure.gravatar.com/avatar/44e30447ae4f8319e312388dd736c266?s=48&d=mm&r=g",
      "96": "https://secure.gravatar.com/avatar/44e30447ae4f8319e312388dd736c266?s=96&d=mm&r=g"
    },
    "meta": [],
    "usermeta": {
      "operating_name1": "",
      "operating_name1_language": "",
      "operating_name2": "",
      "operating_name2_language": "",
      "legal_name": "",
      "legal_name_language": "",
      "also_known_as": "",
      "business_number": "",
      "legal_form": "",
      "charitable_status": "",
      "primary_activity": "",
      "discipline_genre": [
        "dan"
      ],
      "presenting_format": "",
      "occupation": "Q483501",
      "website_official": "http://rhodniedesir.com/",
      "events_page": "",
      "artsdata_id": "",
      "wikidata_id": "Q114868316",
      "venue_name": "",
      "venue_relationship": "",
      "wikidata_id_venue": "",
      "venue_other_name": "",
      "venue_other_relationship": "",
      "wikidata_id_venue_other": "",
      "terms_conditions": "agree (v1.1)",
      "pmpro_bcountry": "CA",
      "pmpro_bcity": "Montreal",
      "pmpro_bstate": "QC",
      "pmpro_approval_12": {
        "status": "approved",
        "timestamp": 1678190497,
        "who": 21,
        "approver": "chandelgambles"
      },
      "pmpro_approval_13": ""
    }
}
saumier commented 1 year ago

I have assigned this issue to @dugost as I am blocked until the description_fr appears.

fjjulien commented 1 year ago

@dugost Please allocate no more than 30 minutes at exploring solutions to this issue. Using a bunch of different WP Plugins to generate open data and content is really not an optimal open data publication strategy. Instead of investing several development hours to extract these French descriptions from CAPACOA's site, I would rather invest these resources into exploring alternative but more robust methods of publishing and using open descriptions in multiple languages.

Here are examples of alternative sources that we could use :

It would make more sense to invest energy in this kind of data reuse, than in generating our own open descriptions that no one else will use.

Recap: Any 30 minutes of debugging. If no solution is found, I will accept the CAPACOA individual member profiles deliverable "as is", with descriptions only displayed in English.

dugost commented 1 year ago

@saumier @fjjulien I didn't realize Polylang wasn't including the 'description_fr" field with the REST API. I thought it was pulling values from any specified field existing in the usermeta table. Thanks for clarifying that.

A quick search suggests that this API functionality is only available with Polylang Pro. I did find this third-party function that might solve it without the need for PLPro but I don't know enough about this right now.

As bios are managed internally, I added 'bio_english' and 'bio_french' as admin-only fields to the PMP set-up. If you look at the Ryan13 test user again, you'll find this sample content being output:

"bio_english":"This is a PMP-based admin-only bio in English.","bio_french":"Il s'agit d'une bio en fran\u00e7ais, bas\u00e9e sur le PMP et r\u00e9serv\u00e9e aux administrateurs.",

If the plugin can display a field depending on the current language, these fields can be used without the need for any other plugins and be managed like any other PMP member data. If this has approval, I'll submit a PR with my revisions and I can move the bios for Richard and Rhodnie on the production site to these new fields.

fjjulien commented 12 months ago

@dugost This is a simple and robust solution. The only disadvantage is that we can't expand it to other languages, without lengthening the admin interface but we don't have immediate plans for adding other languages.

Please implement it.

fjjulien commented 12 months ago

@dugost Please name these two new fields description_en and description_fr. I like the language of a text field to be explicit (even for English).

Regarding the field labels in the admin interface, I would suggest "Member Description - English" and "Member Description - français".

dugost commented 12 months ago

@fjjulien Ok, great. I've added it to the staging site and test user Ryan13 is displaying sample text for both.

To differentiate the fields from the default WordPress biography "description" and the one from Polylang "description_fr", I've labelled these PMP fields "member_description_en" and "member_description_fr".

I also changed the formatting to "Member Description (English)" and "Member Description (français)" to be consistent with other fields. I can revert to hyphens, if you prefer.

About to submit a PR so these fields and the 'MemberTerminationDate' field required for #24 are included in the latest code.

Would you like this added to the production site or wait until Gregory has had a chance to review it and ensure this method will work properly?

fjjulien commented 12 months ago

@dugost Please implement them straight on the production site. Unless I am mistaken, Gregory is only extracting data from the production site anyway.

Brackets are absolutely fine for field labels.

dugost commented 12 months ago

@fjjulien Done.

saumier commented 11 months ago

@dugost The new description fields in metadata will work. But before I update the shortcode, let me know when those new fields are working in production (www.capacoa.ca). To check, here is a link to the data in production that gets loaded into Artsdata. Click this link and search in your browser for Rhodnie Désir. https://www.capacoa.ca/wp-json/wp/v2/users?per_page=100&page=2

dugost commented 11 months ago

@saumier Yes, they do work. Adding those 3 new fields to the production plugin outputs "member_description_en":"","member_description_fr":"","MemberTerminationDate". I don't know if any members have values for those fields, though.

In case it's helpful when searching for members with special characters in their names: searching for 'Rhodnie Désir' gives no result since the é is output as Unicode (Rhodnie D\u00e9sir). Searching for 'Rhodnie' is the way to go. :)

saumier commented 11 months ago

@dugost Thx. Can you add an individual member's english and french description to "member_description_en" and "member_description_fr" in production so I can test the shortcode?

fjjulien commented 11 months ago

@saumier @dugost I populated the "member_description_en" and "member_description_fr" for Rhodnie (user_id=150), so you can proceed with your tests. And I manually reloaded the CAPACOA database to Artsdata.

saumier commented 11 months ago

@fjjulien Thx. I will make the change to the shortcode plugin and test.

saumier commented 11 months ago

@fjjulien @dugost I have released shortcode plugin v1.4.4 with support for bilingual biographies. https://github.com/culturecreates/artsdata-shortcode/releases/tag/v1.4.4

Please install in test, check out the bio of Rhodnie Désir, and if all looks good deploy to production.

dugost commented 11 months ago

@saumier @fjjulien Bilingual bios work so the latest plugin has been activated on production.

saumier commented 11 months ago

Great. Thx. I am closing this issue.