Skip to content

Commit 8bd0baa

Browse files
defstatasmecher
authored andcommittedFeb 17, 2023
pkp/pkp-lib#8598 code occuances of locales changes
1 parent feb2788 commit 8bd0baa

18 files changed

+187
-185
lines changed
 

‎classes/issue/Collector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public function getQueryBuilder(): Builder
397397

398398
// Add support for searching for the volume, number and year
399399
// using the localized issue identification formats. In
400-
// en_US this will match Vol. 1. No. 1 (2018) against:
400+
// en this will match Vol. 1. No. 1 (2018) against:
401401
// i.volume = 1 AND i.number = 1 AND i.year = 2018
402402
$volume = '';
403403
$number = '';

‎cypress.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
env: {
55
contextTitles: {
6-
en_US: 'Journal of Public Knowledge',
6+
en: 'Journal of Public Knowledge',
77
fr_CA: 'Journal de la connaissance du public',
88
},
99
contextDescriptions: {
10-
en_US:
10+
en:
1111
'The Journal of Public Knowledge is a peer-reviewed quarterly publication on the subject of public access to science.',
1212
fr_CA:
1313
"Le Journal de Public Knowledge est une publication trimestrielle évaluée par les pairs sur le thème de l'accès du public à la science.",
1414
},
1515
contextAcronyms: {
16-
en_US: 'JPK',
16+
en: 'JPK',
1717
},
1818
defaultGenre: 'Article Text',
1919
authorUserGroupId: 14,

‎cypress/fixtures/export-issues.xml

+26-26
Large diffs are not rendered by default.

‎cypress/tests/data/10-ApplicationSetup/20-CreateContext.cy.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ describe('Data suite tests', function() {
1919
cy.get('div[id=editContext]').find('button').contains(/French/).click();
2020
cy.get('input[name="name-fr_CA"]').type(Cypress.env('contextTitles')['fr_CA'], {delay: 0});
2121
cy.get('button').contains('Save').click()
22-
cy.get('div[id=context-name-error-en_US]').find('span').contains('This field is required.');
23-
cy.get('div[id=context-acronym-error-en_US]').find('span').contains('This field is required.');
22+
cy.get('div[id=context-name-error-en]').find('span').contains('This field is required.');
23+
cy.get('div[id=context-acronym-error-en]').find('span').contains('This field is required.');
2424
cy.get('div[id=context-contactName-error]').find('span').contains('This field is required.');
2525
cy.get('div[id=context-contactEmail-error]').find('span').contains('This field is required.');
2626
cy.get('div[id=context-urlPath-error]').find('span').contains('This field is required.');
2727
cy.get('div[id=context-primaryLocale-error]').find('span').contains('This field is required.');
28-
cy.get('input[name="name-en_US"]').type(Cypress.env('contextTitles')['en_US'], {delay: 0});
29-
cy.get('input[name=acronym-en_US]').type('JPK', {delay: 0});
28+
cy.get('input[name="name-en"]').type(Cypress.env('contextTitles')['en'], {delay: 0});
29+
cy.get('input[name=acronym-en]').type('JPK', {delay: 0});
3030
cy.get('span').contains('Enable this journal').siblings('input').check();
31-
cy.get('input[name="supportedLocales"][value="en_US').check();
31+
cy.get('input[name="supportedLocales"][value="en').check();
3232
cy.get('input[name="supportedLocales"][value="fr_CA').check();
33-
cy.get('input[name="primaryLocale"][value="en_US').check();
33+
cy.get('input[name="primaryLocale"][value="en').check();
3434
cy.get('select[id=context-country-control]').select('Iceland');
3535
cy.get('input[name=contactName]').type('Ramiro Vaca', {delay: 0});
3636

@@ -48,7 +48,7 @@ describe('Data suite tests', function() {
4848
cy.get('input[name=contactEmail').clear().type('rvaca@mailinator.com', {delay: 0});
4949

5050
// Context descriptions
51-
cy.setTinyMceContent('context-description-control-en_US', Cypress.env('contextDescriptions')['en_US']);
51+
cy.setTinyMceContent('context-description-control-en', Cypress.env('contextDescriptions')['en']);
5252
cy.setTinyMceContent('context-description-control-fr_CA', Cypress.env('contextDescriptions')['fr_CA']);
5353
cy.get('button').contains('Save').click();
5454

@@ -74,17 +74,17 @@ describe('Data suite tests', function() {
7474
cy.contains('Locale settings saved.');
7575

7676
cy.get('button[id="indexing-button"]').click();
77-
cy.get('input[name="searchDescription-en_US"]').type(Cypress.env('contextDescriptions')['en_US'], {delay: 0});
78-
cy.get('textarea[name="customHeaders-en_US"]').type('<meta name="pkp" content="Test metatag.">', {delay: 0});
77+
cy.get('input[name="searchDescription-en"]').type(Cypress.env('contextDescriptions')['en'], {delay: 0});
78+
cy.get('textarea[name="customHeaders-en"]').type('<meta name="pkp" content="Test metatag.">', {delay: 0});
7979
cy.get('div[id=indexing]').find('button').contains('Save').click();
8080

81-
cy.get('label[for="searchIndexing-searchDescription-control-en_US"] ~ button.tooltipButton').click();
81+
cy.get('label[for="searchIndexing-searchDescription-control-en"] ~ button.tooltipButton').click();
8282
cy.get('div').contains('Provide a brief description');
83-
cy.get('label[for="searchIndexing-searchDescription-control-en_US"] ~ button.tooltipButton').click();
83+
cy.get('label[for="searchIndexing-searchDescription-control-en"] ~ button.tooltipButton').click();
8484

8585
// OJS-specific tasks
8686
cy.get('button[id="context-button"]').click();
87-
cy.get('input[name="abbreviation-en_US"]').type('publicknowledge', {delay: 0});
87+
cy.get('input[name="abbreviation-en"]').type('publicknowledge', {delay: 0});
8888
cy.get('div[id=context]').find('button').contains('Save').click();
8989
cy.get('#context [role="status"]').contains('Saved');
9090
});
@@ -95,8 +95,8 @@ describe('Data suite tests', function() {
9595
cy.get('a').contains('Dashboard').click();
9696
cy.get('.app__nav a').contains('Journal').click();
9797

98-
cy.get('input[name="abbreviation-en_US"]').type('J Pub Know', {delay: 0});
99-
cy.get('input[name="acronym-en_US"]').type(Cypress.env('contextAcronyms')['en_US'], {delay: 0});
98+
cy.get('input[name="abbreviation-en"]').type('J Pub Know', {delay: 0});
99+
cy.get('input[name="acronym-en"]').type(Cypress.env('contextAcronyms')['en'], {delay: 0});
100100
cy.get('input[name="publisherInstitution"]').type('Public Knowledge Project', {delay: 0});
101101

102102
// Invalid ISSN

‎cypress/tests/data/10-ApplicationSetup/50-CreateCategories.cy.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ describe('Data suite tests', function() {
1818
// Create an Applied Science category
1919
cy.get('a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click();
2020
cy.wait(1000); // Avoid occasional failure due to form init taking time
21-
cy.get('input[id^="name-en_US-"]').type('Applied Science', {delay: 0});
21+
cy.get('input[id^="name-en-"]').type('Applied Science', {delay: 0});
2222
cy.get('input[id^="path-"]').type('applied-science', {delay: 0});
2323
cy.get('form[id=categoryForm]').contains('OK').click();
2424
cy.get('tr[id^="component-grid-settings-category-categorycategorygrid-category-"] a:contains("Applied Science")');
2525

2626
// Create a Computer Science subcategory
2727
cy.get('a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click();
2828
cy.wait(1000); // Avoid occasional failure due to form init taking time
29-
cy.get('input[id^="name-en_US-"]').type('Computer Science', {delay: 0});
29+
cy.get('input[id^="name-en-"]').type('Computer Science', {delay: 0});
3030
cy.get('select[id="parentId"]').select('Applied Science');
3131
cy.get('input[id^="path-"]').type('comp-sci', {delay: 0});
3232
cy.get('form[id=categoryForm]').contains('OK').click();
@@ -35,7 +35,7 @@ describe('Data suite tests', function() {
3535
// Create an Engineering subcategory
3636
cy.get('a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click();
3737
cy.wait(1000); // Avoid occasional failure due to form init taking time
38-
cy.get('input[id^="name-en_US-"]').type('Engineering', {delay: 0});
38+
cy.get('input[id^="name-en-"]').type('Engineering', {delay: 0});
3939
cy.get('select[id="parentId"]').select('Applied Science');
4040
cy.get('input[id^="path-"]').type('eng', {delay: 0});
4141
cy.get('form[id=categoryForm]').contains('OK').click();
@@ -44,15 +44,15 @@ describe('Data suite tests', function() {
4444
// Create a Social Sciences category
4545
cy.get('a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click();
4646
cy.wait(1000); // Avoid occasional failure due to form init taking time
47-
cy.get('input[id^="name-en_US-"]').type('Social Sciences', {delay: 0});
47+
cy.get('input[id^="name-en-"]').type('Social Sciences', {delay: 0});
4848
cy.get('input[id^="path-"]').type('social-sciences', {delay: 0});
4949
cy.get('form[id=categoryForm]').contains('OK').click();
5050
cy.get('tr[id^="component-grid-settings-category-categorycategorygrid-category-"] a:contains("Social Sciences")');
5151

5252
// Create a Sociology subcategory
5353
cy.get('a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click();
5454
cy.wait(1000); // Avoid occasional failure due to form init taking time
55-
cy.get('input[id^="name-en_US-"]').type('Sociology', {delay: 0});
55+
cy.get('input[id^="name-en-"]').type('Sociology', {delay: 0});
5656
cy.get('select[id="parentId"]').select('Social Sciences');
5757
cy.get('input[id^="path-"]').type('sociology', {delay: 0});
5858
cy.get('form[id=categoryForm]').contains('OK').click();
@@ -61,7 +61,7 @@ describe('Data suite tests', function() {
6161
// Create a Anthropology subcategory
6262
cy.get('a[id^=component-grid-settings-category-categorycategorygrid-addCategory-button-]').click();
6363
cy.wait(1000); // Avoid occasional failure due to form init taking time
64-
cy.get('input[id^="name-en_US-"]').type('Anthropology', {delay: 0});
64+
cy.get('input[id^="name-en-"]').type('Anthropology', {delay: 0});
6565
cy.get('select[id="parentId"]').select('Social Sciences');
6666
cy.get('input[id^="path-"]').type('anthropology', {delay: 0});
6767
cy.get('form[id=categoryForm]').contains('OK').click();

‎cypress/tests/data/10-ApplicationSetup/50-CreateSections.cy.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ describe('Data suite tests', function() {
2828
// Create a Reviews section
2929
cy.get('a[id^=component-grid-settings-sections-sectiongrid-addSection-button-]').click();
3030
cy.wait(1000); // Avoid occasional failure due to form init taking time
31-
cy.get('input[id^="title-en_US-"]').type('Reviews', {delay: 0});
32-
cy.get('input[id^="abbrev-en_US-"]').type('REV', {delay: 0});
33-
cy.get('input[id^="identifyType-en_US-"]').type('Review Article', {delay: 0});
31+
cy.get('input[id^="title-en-"]').type('Reviews', {delay: 0});
32+
cy.get('input[id^="abbrev-en-"]').type('REV', {delay: 0});
33+
cy.get('input[id^="identifyType-en-"]').type('Review Article', {delay: 0});
3434
cy.get('input[id=abstractsNotRequired]').click();
3535
cy.get('label').contains('Daniel Barnes').click();
3636
cy.get('label').contains('Minoti Inoue').click();

‎cypress/tests/data/60-content/AmwandengaSubmission.cy.js

+29-29
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ describe('Data suite: Amwandenga', function() {
113113

114114
// Enter details
115115
cy.get('h2').contains('Submission Details');
116-
cy.setTinyMceContent('titleAbstract-abstract-control-en_US', submission.abstract);
117-
cy.get('#titleAbstract-title-control-en_US').click({force: true}); // Ensure blur event is fired
116+
cy.setTinyMceContent('titleAbstract-abstract-control-en', submission.abstract);
117+
cy.get('#titleAbstract-title-control-en').click({force: true}); // Ensure blur event is fired
118118

119119
cy.get('.submissionWizard__footer button').contains('Continue').click();
120120

@@ -144,11 +144,11 @@ describe('Data suite: Amwandenga', function() {
144144
cy.get('.listPanel__item:contains("Alan Mwandenga")');
145145
cy.get('button').contains('Add Contributor').click();
146146
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
147-
cy.get('#contributor-givenName-error-en_US').contains('This field is required.');
147+
cy.get('#contributor-givenName-error-en').contains('This field is required.');
148148
cy.get('#contributor-email-error').contains('This field is required.');
149149
cy.get('#contributor-country-error').contains('This field is required.');
150-
cy.get('.pkpFormField:contains("Given Name")').find('input[name*="en_US"]').type(submission.authors[0].givenName);
151-
cy.get('.pkpFormField:contains("Family Name")').find('input[name*="en_US"]').type(submission.authors[0].familyName);
150+
cy.get('.pkpFormField:contains("Given Name")').find('input[name*="en"]').type(submission.authors[0].givenName);
151+
cy.get('.pkpFormField:contains("Family Name")').find('input[name*="en"]').type(submission.authors[0].familyName);
152152
cy.get('.pkpFormField:contains("Country")').find('select').select(submission.authors[0].country)
153153
cy.get('.pkpFormField:contains("Email")').find('input').type('notanemail');
154154
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
@@ -174,7 +174,7 @@ describe('Data suite: Amwandenga', function() {
174174

175175
// Delete a contributor
176176
cy.get('.listPanel:contains("Contributors")').find('button').contains('Add Contributor').click();
177-
cy.get('.pkpFormField:contains("Given Name")').find('input[name*="en_US"]').type('Fake Author Name');
177+
cy.get('.pkpFormField:contains("Given Name")').find('input[name*="en"]').type('Fake Author Name');
178178
cy.get('.pkpFormField:contains("Email")').find('input').type('delete@mailinator.com');
179179
cy.get('.pkpFormField:contains("Country")').find('select').select('Barbados');
180180
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
@@ -244,7 +244,7 @@ describe('Data suite: Amwandenga', function() {
244244
// Submit
245245
cy.contains('Make a Submission: Review');
246246
cy.get('button:contains("Submit")').click();
247-
const message = 'The submission, ' + submission.title + ', will be submitted to ' + Cypress.env('contextTitles').en_US + ' for editorial review';
247+
const message = 'The submission, ' + submission.title + ', will be submitted to ' + Cypress.env('contextTitles').en + ' for editorial review';
248248
cy.get('.modal__panel:contains("' + message + '")').find('button').contains('Submit').click();
249249
cy.contains('Submission complete');
250250
cy.get('a').contains('Create a new submission');
@@ -281,35 +281,35 @@ describe('Data suite: Amwandenga', function() {
281281
submission.prefix = 'The';
282282
submission.title = 'Signalling Theory Dividends';
283283
submission.subtitle = 'A Review Of The Literature And Empirical Evidence';
284-
cy.get('#titleAbstract input[name=prefix-en_US]').type(submission.prefix, {delay: 0});
285-
cy.setTinyMceContent('titleAbstract-subtitle-control-en_US', submission.subtitle);
286-
cy.setTinyMceContent('titleAbstract-title-control-en_US', '');
287-
cy.setTinyMceContent('titleAbstract-abstract-control-en_US', submission.abstract.repeat(10));
288-
cy.get('#titleAbstract-title-control-en_US').click({force:true}); // Ensure blur event is fired
289-
cy.get('#titleAbstract-subtitle-control-en_US').click({force: true});
284+
cy.get('#titleAbstract input[name=prefix-en]').type(submission.prefix, {delay: 0});
285+
cy.setTinyMceContent('titleAbstract-subtitle-control-en', submission.subtitle);
286+
cy.setTinyMceContent('titleAbstract-title-control-en', '');
287+
cy.setTinyMceContent('titleAbstract-abstract-control-en', submission.abstract.repeat(10));
288+
cy.get('#titleAbstract-title-control-en').click({force:true}); // Ensure blur event is fired
289+
cy.get('#titleAbstract-subtitle-control-en').click({force: true});
290290
cy.get('#titleAbstract button').contains('Save').click();
291291

292-
cy.get('#titleAbstract [id*=title-error-en_US]').find('span').contains('This field is required.');
293-
cy.setTinyMceContent('titleAbstract-title-control-en_US', submission.title);
292+
cy.get('#titleAbstract [id*=title-error-en]').find('span').contains('This field is required.');
293+
cy.setTinyMceContent('titleAbstract-title-control-en', submission.title);
294294
cy.get('#titleAbstract button').contains('Save').click();
295295

296-
cy.get('#titleAbstract [id*=abstract-error-en_US]').find('span').contains('The abstract is too long.');
297-
cy.setTinyMceContent('titleAbstract-abstract-control-en_US', submission.abstract);
298-
cy.get('#titleAbstract-title-control-en_US').click({force:true}); // Ensure blur event is fired
299-
cy.get('#titleAbstract-subtitle-control-en_US').click({force:true});
296+
cy.get('#titleAbstract [id*=abstract-error-en]').find('span').contains('The abstract is too long.');
297+
cy.setTinyMceContent('titleAbstract-abstract-control-en', submission.abstract);
298+
cy.get('#titleAbstract-title-control-en').click({force:true}); // Ensure blur event is fired
299+
cy.get('#titleAbstract-subtitle-control-en').click({force:true});
300300
cy.get('#titleAbstract button').contains('Save').click();
301301
cy.get('#titleAbstract [role="status"]').contains('Saved');
302302

303303
// Metadata
304304
cy.get('#metadata-button').click();
305-
cy.get('#metadata-keywords-control-en_US').type('Professional Development', {delay: 0});
305+
cy.get('#metadata-keywords-control-en').type('Professional Development', {delay: 0});
306306
cy.get('.autosuggest__results-item').contains('Professional Development');
307-
cy.get('#metadata-keywords-control-en_US').type('{enter}', {delay: 0});
308-
cy.get('#metadata-keywords-selected-en_US').contains('Professional Development');
309-
cy.get('#metadata-keywords-control-en_US').type('Social Transformation', {delay: 0});
307+
cy.get('#metadata-keywords-control-en').type('{enter}', {delay: 0});
308+
cy.get('#metadata-keywords-selected-en').contains('Professional Development');
309+
cy.get('#metadata-keywords-control-en').type('Social Transformation', {delay: 0});
310310
cy.get('.autosuggest__results-item').contains('Social Transformation');
311-
cy.get('#metadata-keywords-control-en_US').type('{enter}', {delay: 0});
312-
cy.get('#metadata-keywords-selected-en_US').contains('Social Transformation');
311+
cy.get('#metadata-keywords-control-en').type('{enter}', {delay: 0});
312+
cy.get('#metadata-keywords-selected-en').contains('Social Transformation');
313313
cy.get('#metadata button').contains('Save').click();
314314
cy.get('#metadata [role="status"]').contains('Saved');
315315

@@ -337,8 +337,8 @@ describe('Data suite: Amwandenga', function() {
337337

338338
cy.get('#contributors button').contains('Add Contributor').click();
339339

340-
cy.get('#contributors [name="givenName-en_US"]').type('Nicolas', {delay: 0});
341-
cy.get('#contributors [name="familyName-en_US"]').type('Riouf', {delay: 0});
340+
cy.get('#contributors [name="givenName-en"]').type('Nicolas', {delay: 0});
341+
cy.get('#contributors [name="familyName-en"]').type('Riouf', {delay: 0});
342342
cy.get('#contributors [name="email"]').type('nriouf@mailinator.com', {delay: 0});
343343
cy.get('#contributors [name="country"]').select('South Africa');
344344
cy.get('#contributors button').contains('Save').click();
@@ -469,7 +469,7 @@ describe('Data suite: Amwandenga', function() {
469469
cy.contains('This version has been published and can not be edited.').should('not.exist');
470470

471471
// Edit unpublished version's title
472-
cy.setTinyMceContent('titleAbstract-title-control-en_US', 'The Signalling Theory Dividends Version 2');
472+
cy.setTinyMceContent('titleAbstract-title-control-en', 'The Signalling Theory Dividends Version 2');
473473
cy.get('#titleAbstract button').contains('Save').click();
474474
cy.get('#titleAbstract [role="status"]').contains('Saved');
475475

@@ -478,7 +478,7 @@ describe('Data suite: Amwandenga', function() {
478478
cy.get('#contributors-button').click();
479479

480480
cy.get('#contributors div').contains('Alan Mwandenga').parent().parent().find('button').contains('Edit').click();
481-
cy.get('#contributors [name="familyName-en_US"]').type(' Version 2', {delay: 0});
481+
cy.get('#contributors [name="familyName-en"]').type(' Version 2', {delay: 0});
482482
cy.get('#contributors button').contains('Save').click();
483483
// cy.get('#contributors button').contains('Save').should("not.be.visible");
484484
cy.wait(1500); // Wait for the grid to reload

‎cypress/tests/data/60-content/CcorinoSubmission.cy.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ describe('Data suite: Ccorino', function() {
5959

6060
cy.get('#publication-button').click();
6161
cy.get('#metadata-button').click();
62-
cy.get('#metadata-keywords-control-en_US').type('pr', {delay: 0});
62+
cy.get('#metadata-keywords-control-en').type('pr', {delay: 0});
6363
cy.wait(500);
6464
cy.get('li').contains('Professional Development').click({force: true});
65-
cy.get('#metadata-keywords-control-en_US').type('socia', {delay: 0});
65+
cy.get('#metadata-keywords-control-en').type('socia', {delay: 0});
6666
cy.contains('Social Transformation');
67-
cy.get('#metadata-keywords-control-en_US').type('l{downarrow}{downarrow}{enter}', {delay: 0});
67+
cy.get('#metadata-keywords-control-en').type('l{downarrow}{downarrow}{enter}', {delay: 0});
6868
cy.get('#metadata button').contains('Save').click();
6969
cy.get('#metadata [role="status"]').contains('Saved');
70-
cy.get('#metadata-keywords-selected-en_US').contains('Professional Development');
71-
cy.get('#metadata-keywords-selected-en_US').contains('Social Transformation');
70+
cy.get('#metadata-keywords-selected-en').contains('Professional Development');
71+
cy.get('#metadata-keywords-selected-en').contains('Social Transformation');
7272
});
7373

7474
it('Logins as a section editor and recommends accept', function() {

0 commit comments

Comments
 (0)
Please sign in to comment.