Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

703: Make glossary entry highlights case insensitive #706

Merged
merged 2 commits into from May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion gp-templates/helper-functions.php
Expand Up @@ -84,7 +84,7 @@ function map_glossary_entries_to_translations_originals( $translations, $glossar

foreach ( $glossary_entries_terms as $i => $terms ) {
$glossary_entry = $glossary_entries[ $i ];
if ( preg_match( '/\b(' . $terms . ')\b/', $t->singular . ' ' . $t->plural, $m ) ) {
if ( preg_match( '/\b(' . $terms . ')\b/i', $t->singular . ' ' . $t->plural, $m ) ) {
$locale_entry = '';
if ( $glossary_entry->glossary_id !== $glossary->id ) {
/* translators: Denotes an entry from the locale glossary in the tooltip */
Expand Down
Expand Up @@ -100,6 +100,9 @@ function test_mapping_entries_to_originals() {
'Someone writes about something.' => array( 'write' ),
'I post about something.' => array( 'post' ),
'Someone posts something.' => array( 'post' ),
'The Post menu should be displayed.' => array( 'post' ), // Make sure glossary entries are matched case insensitivly.
'City water and power were out of service all day.' => array( 'city' ), // Make sure glossary entries are matched case insensitivly.
'Write what you know and you\'ll never go wrong.' => array( 'write' ), // Make sure glossary entries are matched case insensitivly.
);

foreach ( $originals as $original => $terms ) {
Expand Down