6
6
} catch ( error ) {
7
7
application . logger . warn ( "Google Translate Java API not found: Translation feature unavailable." )
8
8
}
9
+ document . execute ( 'register/' )
9
10
10
11
var Goose = Goose || function ( ) {
11
12
var Public = {
@@ -21,7 +22,7 @@ var Goose = Goose || function() {
21
22
"text" : String ( StringEscapeUtils . unescapeHtml ( article . getCleanedArticleText ( ) ) )
22
23
}
23
24
} catch ( error ) {
24
- application . logger . info ( error + ": " + uri )
25
+ application . logger . debug ( error + ": " + uri )
25
26
return null
26
27
}
27
28
if ( srclang && tlang ) {
@@ -37,33 +38,14 @@ var Goose = Goose || function() {
37
38
}
38
39
}
39
40
}
40
-
41
- // Initialize config
42
- Public . config = application . globals . get ( 'proose .config' )
43
- if ( ! Public . config ) {
44
- var config = new Configuration ( )
45
- config . setEnableImageFetching ( false )
46
- Public . config = application . getGlobal ( 'proose.config' , config )
41
+ // Initialize
42
+ Public . config = register ( Configuration , null , { 'setEnableImageFetching' : false } )
43
+ Public . extractor = register ( ContentExtractor , Public . config )
44
+ try {
45
+ Public . translate = register ( Translate , null , { 'setHttpReferrer' : application . globals . get ( 'proose.settings.httpReferrer' ) } )
46
+ } catch ( error ) {
47
+ // Google Translate library is optional
47
48
}
48
-
49
- // Initialize extractor
50
- Public . extractor = application . globals . get ( 'proose.extractor' )
51
- if ( ! Public . extractor && Public . config ) {
52
- Public . extractor = application . getGlobal ( 'proose.extractor' , new ContentExtractor ( Public . config ) )
53
- }
54
-
55
- // Initialize translate (optional)
56
- Public . translate = application . globals . get ( 'proose.translate' )
57
- if ( ! Public . translate ) {
58
- try {
59
- var translate = new Translate ( )
60
- translate . setHttpReferrer ( application . globals . get ( 'proose.settings.httpReferrer' ) )
61
- Public . translate = application . getGlobal ( 'proose.translate' , translate )
62
- }
63
- catch ( x ) {
64
- // translate is optional
65
- }
66
- }
67
49
return Public
68
50
} ( )
69
51
0 commit comments