mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-28 01:50:09 +00:00
Add more survey languages (fr, de, pt/pr-br)
For pt speakers pt-br is shown until we get a pt translation Related core commit: If2c57846f4dfb05ea58f36b25e3d8185d2a6e70e Change-Id: I595446dc59c1bca2ea0b977be9d26f17192d3bc4 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/481
This commit is contained in:
parent
ac59db3d8d
commit
d1a6592185
|
@ -192,14 +192,17 @@
|
|||
* @param {string|null} langcode
|
||||
*/
|
||||
SBP.getFeedbackSurveyBaseUrlForLanguage = function ( langcode ) {
|
||||
var baseUrl = 'https://www.surveymonkey.com/s/media-viewer-1',
|
||||
surveyTranslations = { ca: 1, hu: 1 };
|
||||
var baseLangcode,
|
||||
baseUrl = 'https://www.surveymonkey.com/s/media-viewer-1',
|
||||
surveyTranslations = { ca: 'ca', hu: 'hu', fr: 'fr', pt: 'pt-br', 'pt-br': 'pt-br', de: 'de' };
|
||||
|
||||
langcode = langcode.split( /[_-]/ )[0]; // get rid of variants
|
||||
if ( langcode === 'en') {
|
||||
baseLangcode = langcode.split( /[_-]/ )[0]; // get rid of variants
|
||||
if ( baseLangcode === 'en') {
|
||||
return baseUrl;
|
||||
} else if ( surveyTranslations[langcode] ) {
|
||||
return baseUrl + '-' + langcode;
|
||||
return baseUrl + '-' + surveyTranslations[langcode];
|
||||
} else if ( surveyTranslations[baseLangcode] ) {
|
||||
return baseUrl + '-' + surveyTranslations[baseLangcode];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,25 @@
|
|||
mw.config.set( 'wgUserLanguage', oldLanguage );
|
||||
} );
|
||||
|
||||
QUnit.test( 'getFeedbackSurveyBaseUrlForLanguage()', 7, function ( assert ) {
|
||||
var buttons = createStripeButtons();
|
||||
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'en' ),
|
||||
'https://www.surveymonkey.com/s/media-viewer-1', 'Base survey URL for english' );
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'hu' ),
|
||||
'https://www.surveymonkey.com/s/media-viewer-1-hu', 'Language code appended for supported languages' );
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'el' ),
|
||||
null, 'Null for non-supported languages' );
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'en-gb' ),
|
||||
'https://www.surveymonkey.com/s/media-viewer-1', 'Base survey URL for english variants' );
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'fr-xx' ),
|
||||
'https://www.surveymonkey.com/s/media-viewer-1-fr', 'Base code appended for other variants' );
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'pt-br' ),
|
||||
'https://www.surveymonkey.com/s/media-viewer-1-pt-br', 'Full code appended if the variant itself is supported' );
|
||||
assert.strictEqual( buttons.getFeedbackSurveyBaseUrlForLanguage( 'pt' ),
|
||||
'https://www.surveymonkey.com/s/media-viewer-1-pt-br', 'Temporary special case for pt' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'set()/empty() sanity test:', 1, function ( assert ) {
|
||||
var buttons = createStripeButtons(),
|
||||
fakeImageInfo = { descriptionUrl: '//commons.wikimedia.org/wiki/File:Foo.jpg' },
|
||||
|
|
Loading…
Reference in a new issue