From a02b386eef37b590a03292ce0f846567ac9f7172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Mon, 23 Oct 2023 16:14:48 +0200 Subject: [PATCH] DevLangCodeRetriever: Adjust property-id used for language code (#546) This was changed in production to use the broader coverage provided by IETF code, see T348923. Bug: T348923 Co-authored-by: Lucas Werkmeister --- cypress/e2e/NewLexemeForm.cy.js | 4 ++-- src/data-access/DevLangCodeRetriever.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/NewLexemeForm.cy.js b/cypress/e2e/NewLexemeForm.cy.js index 484b9330..aa456fb6 100644 --- a/cypress/e2e/NewLexemeForm.cy.js +++ b/cypress/e2e/NewLexemeForm.cy.js @@ -40,10 +40,10 @@ describe( 'NewLexemeForm', () => { cy.intercept( { query: { action: 'wbgetclaims' } }, { claims: { - P218: [ { + P305: [ { mainsnak: { snaktype: 'value', - property: 'P218', + property: 'P305', hash: 'faa942355921695b9fa30805f0bb66bc7ed5a433', datavalue: { value: 'en-gb', diff --git a/src/data-access/DevLangCodeRetriever.ts b/src/data-access/DevLangCodeRetriever.ts index 6c68e2e8..ad1cf0a1 100644 --- a/src/data-access/DevLangCodeRetriever.ts +++ b/src/data-access/DevLangCodeRetriever.ts @@ -6,12 +6,12 @@ export default class DevLangCodeRetriever implements LangCodeRetriever { const response = await fetch( 'https://www.wikidata.org/w/api.php?' + new URLSearchParams( { action: 'wbgetclaims', entity: itemId, - property: 'P218', + property: 'P305', props: '', format: 'json', origin: '*', } ) ).then( ( r ) => r.json() ) as WbGetClaimsResponse; - return processWbGetClaimsResponse( response, 'P218' ); + return processWbGetClaimsResponse( response, 'P305' ); } }