Created
June 12, 2016 21:29
-
-
Save matlam/72604eb9274538fcd47b9afff8fa6cda to your computer and use it in GitHub Desktop.
translate search placeholder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/template/default/index_template.inc.php b/template/default/index_template.inc.php | |
index 65465ff..c2b5673 100644 | |
--- a/template/default/index_template.inc.php | |
+++ b/template/default/index_template.inc.php | |
@@ -90,7 +90,7 @@ include "partials/nav.php"; | |
?> | |
<h1 class="s-main-title animated fadeInUp delay1"><?php echo $page_title ?></h1> | |
<form action="index.php" method="get" autocomplete="off"> | |
- <input type="text" id="keyword" class="s-search animated fadeInUp delay4" name="keywords" value="" lang="<?php echo $sysconf['default_lang']; ?>" role="search"> | |
+ <input type="text" id="keyword" class="s-search animated fadeInUp delay4" name="keywords" value="" lang="<?php echo $sysconf['default_lang']; ?>" role="search" placeholder="<?php echo __('e.g. Library and Information'); ?>"> | |
<button type="submit" name="search" value="search" class="s-btn animated fadeInUp delay4"><?php echo __('Search'); ?></button> | |
</form> | |
</div> | |
@@ -191,7 +191,7 @@ include "partials/nav.php"; | |
--> | |
</p> | |
</div> | |
- <input type="text" class="s-search animated fadeInUp delay4" id="keyword" name="keywords" value="" lang="<?php echo $sysconf['default_lang']; ?>" aria-hidden="true" autocomplete="off"> | |
+ <input type="text" class="s-search animated fadeInUp delay4" id="keyword" name="keywords" value="" lang="<?php echo $sysconf['default_lang']; ?>" aria-hidden="true" autocomplete="off" placeholder="<?php echo __('e.g. Library and Information'); ?>"> | |
<button type="submit" name="search" value="search" class="s-btn animated fadeInUp delay4"><?php echo __('Search'); ?></button> | |
<div id="fkbx-spch" tabindex="0" aria-label="Telusuri dengan suara" style="display: block;"></div> | |
</form> | |
diff --git a/template/default/js/custom.js b/template/default/js/custom.js | |
index b36d705..4f11e97 100644 | |
--- a/template/default/js/custom.js | |
+++ b/template/default/js/custom.js | |
@@ -1,9 +1,13 @@ | |
$(document).ready(function(){ | |
// Show or hide placeholder inside Search form | |
+ // to support translation, the placeholder text | |
+ // is generated in the php-template | |
// ============================================ | |
+ var originalPlaceholder = $('.s-search').attr('placeholder'); | |
+ $('.s-search').removeAttr('placeholder'); | |
$('.s-search').focus(function(){ | |
- $(this).attr('placeholder','e.g. Library and Information'); | |
+ $(this).attr('placeholder',originalPlaceholder); | |
}) | |
$('.s-search').blur(function(){ | |
$(this).removeAttr('placeholder'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment