|
1 | | -(function(){ |
| 1 | +var Multilingual = (function(){ |
2 | 2 | //load languages |
3 | 3 | var pdf_url = 'REDCAP_PDF_URL'; |
4 | 4 | var ajax_url = 'REDCAP_AJAX_URL'; |
5 | 5 | var langVar = 'REDCAP_LANGUAGE_VARIABLE'; |
6 | 6 |
|
| 7 | + //get language choice from url |
| 8 | + getURLLanguage(); |
| 9 | + |
7 | 10 | var project_id = getVariable('pid'); |
8 | 11 | //var languages = {1: 'en', 2: 'es', 3: 'fr'}; |
9 | 12 | var languages = {1: 'en', 2: 'es'}; |
|
194 | 197 | } |
195 | 198 | } |
196 | 199 | } |
| 200 | + |
| 201 | + function getURLLanguage(){ |
| 202 | + //use url |
| 203 | + if(getVariable(langVar)){ |
| 204 | + setNormalCookie('p1000Lang', getVariable(langVar), .04); |
| 205 | + return; |
| 206 | + } |
| 207 | + } |
197 | 208 |
|
198 | 209 | function loadSettings(){ |
199 | 210 | // Get Settings JSON |
|
579 | 590 | $('#' + id + '-tr').find('button').html(translations['answers'][id]['text'][0]); |
580 | 591 | } |
581 | 592 | else if(translations['answers'][id]['type'] == 'signature'){ |
582 | | - $('#' + id + '-tr').children().last().children().eq(3).children().eq(1).html(translations['answers'][id]['text'][0]); |
| 593 | + $('#' + id + '-tr').find('.fileuploadlink').html(translations['answers'][id]['text'][0]); |
583 | 594 | } |
584 | 595 | else if(translations['answers'][id]['type'] == 'file'){ |
585 | | - $('#' + id + '-tr').children().last().children().eq(2).children().eq(1).html(translations['answers'][id]['text'][0]); |
| 596 | + $('#' + id + '-tr').find('.fileuploadlink').html(translations['answers'][id]['text'][0]); |
586 | 597 | } |
587 | 598 | else if(translations['answers'][id]['type'] == 'slider'){ |
588 | 599 | if (translations['answers'][id]['text'][0] != null) $('#sldrlaba-' + id).html(translations['answers'][id]['text'][0]); |
|
633 | 644 | var id2; |
634 | 645 | for(id2 in translations['answers'][id]['text']){ |
635 | 646 | $('#'+id+'-tr .choicevert').each(function(){ |
636 | | - $(this).show(); |
| 647 | + //$(this).show(); |
637 | 648 | if($(this).find('[name="__chk__' + id + '_RC_' + id2 + '"]').length) { |
638 | 649 | $(this).contents().last().html(' ' + translations['answers'][id]['text'][id2]); |
639 | 650 | $(this).data('lang', lang); |
|
646 | 657 | for(id2 in translations['answers'][id]['text']){ |
647 | 658 | $('.ec').each(function(){ |
648 | 659 | var tmp = $(this).parent().attr('comps').split(','); |
649 | | - $(this).show(); |
| 660 | + //$(this).show(); |
650 | 661 | if(tmp[0] == id && tmp[2] == id2) { |
651 | 662 | $(this).html(translations['answers'][id]['text'][id2]); |
652 | 663 | $(this).data('lang', lang); |
|
0 commit comments