Skip to content

Commit

Permalink
Merge pull request #6263 from tcoupin/i18n-shib
Browse files Browse the repository at this point in the history
move shibboleth i18n from js to bundle
  • Loading branch information
kcondon authored Oct 9, 2019
2 parents 3bf9091 + 3b441dc commit 67da504
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 123 deletions.
23 changes: 23 additions & 0 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2417,3 +2417,26 @@ Video=Video
#access - Facet Labels
Public=Public
Restricted=Restricted


#Shibboleth login
idp.fatal.divMissing=<div> specified as &quot;insertAtDiv&quot; could not be located in the HTML
idp.fatal.noXMLHttpRequest=Browser does not support XMLHttpRequest, unable to load IdP selection data
idp.fatal.wrongProtocol=Policy supplied to DS was not &quot;urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single&quot;
idp.fatal.wrongEntityId=entityId supplied by SP did not match configuration
idp.fatal.noData=Metadata download returned no data
idp.fatal.loadFailed=Failed to download metadata from
idp.fatal.noparms=No parameters to discovery session and no defaultReturn parameter configured
idp.fatal.noReturnURL=No URL return parameter provided
idp.fatal.badProtocol=Return request must start with https:// or http://
idp.idpPreferred.label=Use a previous selection:
idp.idpEntry.label=Or enter your institution's name.
idp.idpEntry.NoPreferred.label=Enter your institution's name and click &quot;Continue&quot; to log in via your institution's authentication system.
idp.idpList.label=Or select your institution from the list below.
idp.idpList.NoPreferred.label=Select your institution and click &quot;Continue&quot; to log in via your institution's authentication system.
idp.idpList.defaultOptionLabel=Please select...
idp.idpList.showList=Allow me to pick from a list
idp.idpList.showSearch=Allow me to type the name of my institution
idp.submitButton.label=Continue
idp.helpText=Help
idp.defaultLogoAlt=
24 changes: 23 additions & 1 deletion src/main/webapp/loginpage.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,30 @@

<script>
shibRedirectPage = '';
</script>
shibLang = "#{facesContext.viewRoot.locale}";
shibLangBundle = {};
shibLangBundle["fatal.divMissing"] = "#{bundle['idp.fatal.divMissing']}";
shibLangBundle["fatal.noXMLHttpRequest"] = "#{bundle['idp.fatal.noXMLHttpRequest']}";
shibLangBundle["fatal.wrongProtocol"] = "#{bundle['idp.fatal.wrongProtocol']}";
shibLangBundle["fatal.wrongEntityId"] = "#{bundle['idp.fatal.wrongEntityId']}";
shibLangBundle["fatal.noData"] = "#{bundle['idp.fatal.noData']}";
shibLangBundle["fatal.loadFailed"] = "#{bundle['idp.fatal.loadFailed']}";
shibLangBundle["fatal.noparms"] = "#{bundle['idp.fatal.noparms']}";
shibLangBundle["fatal.noReturnURL"] = "#{bundle['idp.fatal.noReturnURL']}";
shibLangBundle["fatal.badProtocol"] = "#{bundle['idp.fatal.badProtocol']}";
shibLangBundle["idpPreferred.label"] = "#{bundle['idp.idpPreferred.label']}";
shibLangBundle["idpEntry.label"] = "#{bundle['idp.idpEntry.label']}";
shibLangBundle["idpEntry.NoPreferred.label"] = "#{bundle['idp.idpEntry.NoPreferred.label']}";
shibLangBundle["idpList.label"] = "#{bundle['idp.idpList.label']}";
shibLangBundle["idpList.NoPreferred.label"] = "#{bundle['idp.idpList.NoPreferred.label']}";
shibLangBundle["idpList.defaultOptionLabel"] = "#{bundle['idp.idpList.defaultOptionLabel']}";
shibLangBundle["idpList.showList"] = "#{bundle['idp.idpList.showList']}";
shibLangBundle["idpList.showSearch"] = "#{bundle['idp.idpList.showSearch']}";
shibLangBundle["submitButton.label"] = "#{bundle['idp.submitButton.label']}";
shibLangBundle["helpText"] = "#{bundle['idp.helpText']}";
shibLangBundle["defaultLogoAlt"] = "#{bundle['idp.defaultLogoAlt']}";

</script>
<script src="/resources/js/shib/idpselect_config.js"></script>
<script src="/resources/js/shib/idpselect.js"></script>
<script src="/resources/js/shib/idpselect_style.js"></script>
Expand Down
31 changes: 2 additions & 29 deletions src/main/webapp/resources/js/shib/idpselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,6 @@ function IdPSelectUI() {
var lang;
var majorLang;
var defaultLang;
var langBundle;
var defaultLangBundle;
var defaultLogo;
var defaultLogoWidth;
var defaultLogoHeight;
Expand Down Expand Up @@ -1022,35 +1020,13 @@ function IdPSelectUI() {
maxIdPCharsDropDown = paramsSupplied.maxIdPCharsDropDown;
maxIdPCharsAltTxt = paramsSupplied.maxIdPCharsAltTxt;

if (typeof navigator == 'undefined') {
lang = paramsSupplied.defaultLanguage;
} else {
lang = navigator.language || navigator.userLanguage || paramsSupplied.defaultLanguage;
}
lang = shibLang || paramsSupplied.defaultLanguage;
if (lang.indexOf('-') > 0) {
majorLang = lang.substring(0, lang.indexOf('-'));
}

defaultLang = paramsSupplied.defaultLanguage;

if (typeof paramsSupplied.langBundles[lang] != 'undefined') {
langBundle = paramsSupplied.langBundles[lang];
} else if (typeof majorLang != 'undefined' && typeof paramsSupplied.langBundles[majorLang] != 'undefined') {
langBundle = paramsSupplied.langBundles[majorLang];
}
defaultLangBundle = paramsSupplied.langBundles[paramsSupplied.defaultLanguage];

//
// Setup Language bundles
//
if (!defaultLangBundle) {
fatal('No languages work');
return false;
}
if (!langBundle) {
debug('No language support for ' + lang);
langBundle = defaultLangBundle;
}

if (paramsSupplied.testGUI) {
//
Expand Down Expand Up @@ -1876,10 +1852,7 @@ function IdPSelectUI() {
*/
var getLocalizedMessage = function(messageId){

var message = langBundle[messageId];
if(!message){
message = defaultLangBundle[messageId];
}
var message = shibLangBundle[messageId];
if(!message){
message = 'Missing message for ' + messageId;
}
Expand Down
93 changes: 0 additions & 93 deletions src/main/webapp/resources/js/shib/idpselect_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,99 +37,6 @@ function IdPSelectUIParms() {
this.testGUI = false;


//
// Globalization stuff
//
this.langBundles = {
'en': {
'fatal.divMissing': '<div> specified as "insertAtDiv" could not be located in the HTML',
'fatal.noXMLHttpRequest': 'Browser does not support XMLHttpRequest, unable to load IdP selection data',
'fatal.wrongProtocol': 'Policy supplied to DS was not "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"',
'fatal.wrongEntityId': 'entityId supplied by SP did not match configuration',
'fatal.noData': 'Metadata download returned no data',
'fatal.loadFailed': 'Failed to download metadata from ',
'fatal.noparms': 'No parameters to discovery session and no defaultReturn parameter configured',
'fatal.noReturnURL': "No URL return parameter provided",
'fatal.badProtocol': "Return request must start with https:// or http://",
'idpPreferred.label': 'Use a previous selection:',
'idpEntry.label': 'Or enter your institution\'s name.',
'idpEntry.NoPreferred.label': 'Enter your institution\'s name and click "Continue" to log in via your institution\'s authentication system.',
'idpList.label': 'Or select your institution from the list below.',
'idpList.NoPreferred.label': 'Select your institution and click "Continue" to log in via your institution\'s authentication system.',
'idpList.defaultOptionLabel': 'Please select...',
'idpList.showList': 'Allow me to pick from a list',
'idpList.showSearch': 'Allow me to type the name of my institution',
'submitButton.label': 'Continue',
'helpText': 'Help',
'defaultLogoAlt': ' '
},
'de': {
'fatal.divMissing': 'Das notwendige Div Element fehlt',
'fatal.noXMLHttpRequest': 'Ihr Webbrowser unterst\u00fctzt keine XMLHttpRequests, IdP-Auswahl kann nicht geladen werden',
'fatal.wrongProtocol': 'DS bekam eine andere Policy als "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"',
'fatal.wrongEntityId': 'Die entityId ist nicht korrekt',
'fatal.loadFailed': 'Metadaten konnten nicht heruntergeladen werden: ',
'fatal.noparms': 'Parameter f\u00fcr das Discovery Service oder \'defaultReturn\' fehlen',
'fatal.noReturnURL': "URL return Parmeter fehlt",
'fatal.badProtocol': "return Request muss mit https:// oder http:// beginnen",
'idpPreferred.label': 'Vorherige Auswahl:',
'idpEntry.label': 'Oder geben Sie den Namen (oder Teile davon) an:',
'idpEntry.NoPreferred.label': 'Namen (oder Teile davon) der Institution angeben:',
'idpList.label': 'Oder w\u00e4hlen Sie Ihre Institution aus einer Liste:',
'idpList.NoPreferred.label': 'Institution aus folgender Liste w\u00e4hlen:',
'idpList.defaultOptionLabel': 'W\u00e4hlen Sie Ihre Institution aus...',
'idpList.showList': 'Institution aus einer Liste w\u00e4hlen',
'idpList.showSearch': 'Institution selbst angeben',
'submitButton.label': 'OK',
'helpText': 'Hilfe',
'defaultLogoAlt': 'Standard logo'
},
'ja': {
'fatal.divMissing': '"insertAtDiv" の ID を持つ <div> が HTML 中に存在しません',
'fatal.noXMLHttpRequest': 'ブラウザが XMLHttpRequest をサポートしていないので IdP 情報を取得できません',
'fatal.wrongProtocol': 'DSへ渡された Policy パラメータが "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single" ではありません',
'fatal.wrongEntityId': 'SP から渡された entityId が設定値と異なります',
'fatal.noData': 'メタデータが空です',
'fatal.loadFailed': '次の URL からメタデータをダウンロードできませんでした: ',
'fatal.noparms': 'DSにパラメータが渡されておらず defaultReturn も設定されていません',
'fatal.noReturnURL': "戻り URL が指定されていません",
'fatal.badProtocol': "戻り URL は https:// か http:// で始まらなければなりません",
'idpPreferred.label': '選択候補の IdP:',
'idpEntry.label': 'もしくはあなたの所属機関名を入力してください',
'idpEntry.NoPreferred.label': 'あなたの所属機関名を入力してください',
'idpList.label': 'もしくはあなたの所属機関を選択してください',
'idpList.NoPreferred.label': 'あなたの所属機関を一覧から選択してください',
'idpList.defaultOptionLabel': '所属機関を選択してください...',
'idpList.showList': '一覧から選択する',
'idpList.showSearch': '機関名を入力する',
'submitButton.label': '選択',
'helpText': 'Help',
'defaultLogoAlt': 'DefaultLogo'
},
'pt-br': {
'fatal.divMissing': 'A tag <div> com "insertAtDiv" não foi encontrada no arquivo HTML',
'fatal.noXMLHttpRequest': 'Seu navegador não suporta "XMLHttpRequest", impossível de carregador os dados do IdP selecionado',
'fatal.wrongProtocol': 'A política "Policy" fornecida para o DS não foi "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"',
'fatal.wrongEntityId': 'entityId oferecido pelo SP não confere com o da configuração',
'fatal.noData': 'O arquivo de metadados não retornou nada;',
'fatal.loadFailed': 'Falhou ao realizar download do metadado de ',
'fatal.noparms': 'Sem parâmetros para sessão de descoberta e sem parâmetro "defaultReturn" configurado',
'fatal.noReturnURL': "Não foi definida um endereço (URL) de retorno no parâmetro",
'fatal.badProtocol': "Retorno do endereço requisitado deve começar com https:// ou http://",
'idpPreferred.label': 'Use estas Instituições sugeridas: ',
'idpEntry.label': 'Ou informe o nome da sua Instituição',
'idpEntry.NoPreferred.label': 'Informe o nome da sua Instituição',
'idpList.label': 'Ou selecione sua Instituição através da lista abaixo',
'idpList.NoPreferred.label': 'Selecione sua Instituição através da lista abaixo',
'idpList.defaultOptionLabel': 'Por favor, selecione sua Instituição: ',
'idpList.showList': 'Permitir que eu escolha um IdP através de uma lista',
'idpList.showSearch': 'Permitir que eu especifique o IdP',
'submitButton.label': 'Continuar ',
'helpText': 'Ajuda',
'defaultLogoAlt': 'Logo padrão'
}
};

//
// The following should not be changed without changes to the css. Consider them as mandatory defaults
//
Expand Down

0 comments on commit 67da504

Please sign in to comment.