From ca3b0348c5fe55ccc9af48244bfcf14c7341d2a3 Mon Sep 17 00:00:00 2001 From: mwjames Date: Tue, 2 Jun 2015 14:30:31 +0200 Subject: [PATCH] 1.1 release --- README.md | 23 +++++++++---------- RELEASE-NOTES.md | 9 ++++++-- SemanticInterlanguageLinks.php | 2 +- i18n/en.json | 2 +- src/Search/LanguageResultMatchFinder.php | 2 +- .../Search/LanguageResultMatchFinderTest.php | 5 ++++ 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 4d3243f..7d6eb06 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ create and manage interlanguage links. This extension creates interlanguage links and provides queryable annotations that can connect pages with similar content for different languages to be accessible via the [sitelink navigation][sitelink] -by using the `INTERLANGUAGELINK` parser function. +by using the `interlanguagelink` parser function. The following [video](https://vimeo.com/115871518) demonstrates "How SIL works" without much user interaction or complex editing procedures. @@ -21,7 +21,7 @@ without much user interaction or complex editing procedures. - PHP 5.3.2 or later - MediaWiki 1.23 or later -- [Semantic MediaWiki][smw] 2.1+ +- [Semantic MediaWiki][smw] 2.1 or later ## Installation @@ -31,22 +31,22 @@ with an entry in MediaWiki's `composer.json`. ```json { "require": { - "mediawiki/semantic-interlanguage-links": "~1.0" + "mediawiki/semantic-interlanguage-links": "~1.1" } } ``` 1. From your MediaWiki installation directory, execute - `composer require mediawiki/semantic-interlanguage-links:~1.0` + `composer require mediawiki/semantic-interlanguage-links:~1.1` 2. Navigate to _Special:Version_ on your wiki and verify that the package have been successfully installed. ## Usage -The parser function `{{INTERLANGUAGELINK: language code | interlanguage reference }}` (or `{{interlanguagelink: ...}}`) provides in-text annotation support with the first argument being a language code (e.g `es`, `ja`) while the second argument contains an arbitrary reference (`interlanguage reference`) that describes similar content for different languages. +The parser function `{{interlanguagelink: language code | interlanguage reference }}` provides in-text annotation support with the first argument being a language code (e.g `es`, `ja`) while the second argument contains an arbitrary reference (`interlanguage reference`) that describes similar content for different languages. ![sil](https://cloud.githubusercontent.com/assets/1245473/7594045/0d88d938-f919-11e4-9c79-8e8d166c507a.png) -The parser function `{{INTERLANGUAGELIST: interlanguage reference | template }}` can generate a customizable language target link list for the selected `interlanguage reference` to be available as wikitext inclusion using a template with the following parameters: +The parser function `{{interlanguagelist: interlanguage reference | template }}` can generate a customizable language target link list for the selected `interlanguage reference` to be available as wikitext inclusion using a template with the following parameters: - `target-link` being the target link - `lang-code` the language code - `lang-name` representing the localized language name for the language code @@ -66,7 +66,7 @@ Page: Foo Lorem ipsum dolor sit amet, sale lucilius id mei, pri id prima legendos, at vix tantas habemus tincidunt. -{{INTERLANGUAGELINK:la|Lorem ipsum}} +{{interlanguagelink:la|Lorem ipsum}} ``` ```text Page:Bar @@ -79,7 +79,7 @@ Page:Bar #### List languages -Using `Template:InterlanguageLinksTemplate` in `INTERLANGUAGELIST` will output all available links to the `Lorem ipsum` reference on top of the page `FooBar`. +Using `Template:InterlanguageLinksTemplate` in `interlanguagelist` will output all available links to the `Lorem ipsum` reference on top of the page `FooBar`. ```text Template:InterlanguageLinksTemplate @@ -90,7 +90,7 @@ Template:InterlanguageLinksTemplate ```text Page:FooBar -{{INTERLANGUAGELIST:Lorem ipsum|InterlanguageLinksTemplate}} +{{interlanguagelist:Lorem ipsum|InterlanguageLinksTemplate}} ``` @@ -104,9 +104,8 @@ Page:FooBar ### Configuration -`$GLOBALS['egSILCacheType'] = CACHE_ANYTHING;` is being set to be the default value to improve query lookups during each page view with cache invalidation being carried out during any delete, change or move action. - -In case `$GLOBALS['wgHideInterlanguageLinks']` is enabled (set to `true`), no sitelinks or annotations are created. +- `$GLOBALS['egSILCacheType'] = CACHE_ANYTHING;` is being set to be the default value to improve query lookups during each page view with cache invalidation being carried out during any delete, change or move action. +- `$GLOBALS['wgHideInterlanguageLinks']` is enabled (set to `true`), no sitelinks or annotations are created (in order to correspond to the MW default behaviour for interwiki links) ## Contribution and support diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 11206ae..7c06a56 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,6 +1,11 @@ -### 1.0.0 +### 1.1.0 (2015-06-02) -Released on 2015-02-14 +* Only match results in `Special:Search` for the selected language that contains an annotation +* Fixed behaviour in `ByLanguageCategoryPage` for when languages are switched +* #32 Fixed exception in `Special:Search` for no results +* Localisation updates from https://translatewiki.net + +### 1.0.0 (2015-02-14) * Initial release * Added the `onoi/cache:~1.0` dependency diff --git a/SemanticInterlanguageLinks.php b/SemanticInterlanguageLinks.php index bf709fa..3e8c504 100644 --- a/SemanticInterlanguageLinks.php +++ b/SemanticInterlanguageLinks.php @@ -22,7 +22,7 @@ return 1; } -define( 'SIL_VERSION', '1.0' ); +define( 'SIL_VERSION', '1.1.0' ); /** * @codeCoverageIgnore diff --git a/i18n/en.json b/i18n/en.json index 2b90b49..686edd6 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -18,7 +18,7 @@ "sil-interlanguagelist-missing-linkreference": "The parser function is missing a valid reference.", "sil-interlanguagelist-missing-template": "The parser function is missing an output template.", "sil-interlanguageparser-linkreference-error": "The parser function had a problem to create a title object from \"$1\".", - "sil-search-profile":"by Language", + "sil-search-profile":"By Language", "sil-search-profile-tooltip":"Filter articles by language annotation", "sil-search-languagefilter-label":"Filter by Language", "sil-search-nolanguagefilter":"No language filter", diff --git a/src/Search/LanguageResultMatchFinder.php b/src/Search/LanguageResultMatchFinder.php index 631c9bf..045c551 100644 --- a/src/Search/LanguageResultMatchFinder.php +++ b/src/Search/LanguageResultMatchFinder.php @@ -47,7 +47,7 @@ public function matchResultsToLanguage( SearchResultSet $matches, $languageCode $pageLanguage = $this->interlanguageLinksLookup->findPageLanguageForTarget( $title ); - if ( $pageLanguage === $languageCode ) { + if ( $pageLanguage === $languageCode && $this->interlanguageLinksLookup->hasSilAnnotationFor( $title ) ) { $mappedMatches[] = $searchresult; } } diff --git a/tests/phpunit/Unit/Search/LanguageResultMatchFinderTest.php b/tests/phpunit/Unit/Search/LanguageResultMatchFinderTest.php index db4026b..e1583a1 100644 --- a/tests/phpunit/Unit/Search/LanguageResultMatchFinderTest.php +++ b/tests/phpunit/Unit/Search/LanguageResultMatchFinderTest.php @@ -84,6 +84,11 @@ public function testMatchResultsToLanguageForValidSearchResultSet() { ->disableOriginalConstructor() ->getMock(); + $interlanguageLinksLookup->expects( $this->atLeastOnce() ) + ->method( 'hasSilAnnotationFor' ) + ->with( $this->equalTo( $title ) ) + ->will( $this->returnValue( true ) ); + $interlanguageLinksLookup->expects( $this->atLeastOnce() ) ->method( 'findPageLanguageForTarget' ) ->with( $this->equalTo( $title ) )