Index: trunk/extensions/WikiBhasha/src/lang/en/strings.js |
— | — | @@ -21,99 +21,99 @@ |
22 | 22 | */ |
23 | 23 | (function() { |
24 | 24 | |
25 | | - wikiBhasha.localStrings = { |
| 25 | + wikiBhasha.localStrings = { |
26 | 26 | |
27 | | - failureMsg: "Unable to launch WikiBhasha\n", |
28 | | - collaborativeTitle: "Welcome to WikiBhasha beta, a collaborative tool for enhancing multilingual content in Wikipedias.", |
29 | | - collaborativeSearchTitle: "Please input terms to search for within English and the target language Wikipedias.", |
30 | | - currentLanguage1: "You are currently on the", |
31 | | - currentLanguage2: "article in the English Wikipedia.", |
32 | | - exit: "Exit WikiBhasha", |
33 | | - languageArticle: "Select the target language.", |
34 | | - detectArticle: "This article does not exist in the target language Wikpedia. Please provide a title to create one.", |
35 | | - existingtArticle: "This article already exists in the target language.", |
36 | | - notApplicableStep: "This step in not applicable for current article.", |
37 | | - important: "Important!", |
38 | | - importantNote: "Please click on the \"WikiBhasha (Beta)\" bookmarklet again when you are in the target language Wikipedia!", |
39 | | - contributeBtn: "Contribute to its version in another language", |
40 | | - articleTitle: "Article Title", |
41 | | - searchTabTitle: "Search for source article", |
42 | | - contributeTo: "Enhance existing article in target language", |
43 | | - create: "Create new article in the target language", |
44 | | - space: " ", |
45 | | - dot: ".", |
46 | | - themeBlue: "Theme Blue", |
47 | | - themeBlack: "Theme Black", |
48 | | - themeSilver: "Theme Silver", |
49 | | - help: "Help", |
50 | | - maximize: "Maximize", |
51 | | - close: "Close", |
52 | | - sourceArticle: "Source Article", |
53 | | - search: "Search", |
54 | | - historyLabel: "Visited Topics", |
55 | | - translate: "Translate to", |
56 | | - scratchPad: "Scratch Pad", |
57 | | - searchHeader: "Search", |
58 | | - convertEntireArticle: "Get the entire article from Source", |
59 | | - emptySearchResult: "There were no results matching the query.", |
60 | | - english: "English", |
61 | | - toText: "to", |
62 | | - bringContentFromPane: "Bring the translated & corrected source content", |
63 | | - articleAlreadyExists: "An article with title '{0}' already exists in target language Wikipedia, do you want to edit this page?", |
64 | | - emptySearchResult: "There were no results matching the query.", |
65 | | - emptySource: "No Inter-wiki-linked English article exists, for the topic you are working on currently. You may want to search for appropriate material using the ‘Search’ feature.", |
66 | | - emptyInputText: "Please enter a valid text and continue.", |
67 | | - unSupportedLanguage: "This target language is not currently supported in WikiBhasha.", |
68 | | - invalidBookmarklet: "Please select appropriate book marklet", |
69 | | - defaultLanguageText: "Select Language", |
70 | | - warningMsg: "Please save your work", |
71 | | - clearAll: "Clear All", |
72 | | - sourceTextHeader: "Source Text", |
73 | | - translatedTextHeader: "Translated Text", |
74 | | - loadingElementContent: "Loading article...", |
75 | | - sourceArticleNotApplicable: "Source language content is not applicable here.", |
76 | | - scratchPadTextLimitConfirmMsg: "The entered text exceeds given limit of {0} characters.\n\nIf you continue to translate, it will discard the text that is beyond the limit", |
77 | | - scratchPadTextLimitNote: "Maximum characters allowed per translation are {0} characters", |
78 | | - feedbackTextLimitNote: "[Maximum of {0} characters]", |
79 | | - feedbackThankYouMessage: "Thank you for the feedback.", |
80 | | - feedbackErrorMessage: "Could not submit your feedback.<br/><br/>Click <a href='javascript:;' id='feedbackEmailLink'>here</a> to submit via e-mail.", |
81 | | - feedbackEmptyTextAlertMessage: "Please select one option or enter some text in the provided text area.", |
82 | | - warningSaveComposeChanges: "Any changes made in this step would be lost if you move to an earlier step. Do you want to move anyway?", |
83 | | - noTargetLanguageArticleFound: "Linked article not found in target language Wikipedia.", |
84 | | - feedbackQuestionMessage: "Before leaving WikiBhasha, would you like to give us feedback?", |
85 | | - previewErrorMessage: "Unable to show the preview.", |
86 | | - loadingPreviewContent: "Loading Preview...", |
| 27 | + failureMsg: "Unable to launch WikiBhasha\n", |
| 28 | + collaborativeTitle: "Welcome to WikiBhasha beta, a collaborative tool for enhancing multilingual content in Wikipedias.", |
| 29 | + collaborativeSearchTitle: "Please input terms to search for within English and the target language Wikipedias.", |
| 30 | + currentLanguage1: "You are currently on the", |
| 31 | + currentLanguage2: "article in the English Wikipedia.", |
| 32 | + exit: "Exit WikiBhasha", |
| 33 | + languageArticle: "Select the target language.", |
| 34 | + detectArticle: "This article does not exist in the target language Wikpedia. Please provide a title to create one.", |
| 35 | + existingtArticle: "This article already exists in the target language.", |
| 36 | + notApplicableStep: "This step in not applicable for current article.", |
| 37 | + important: "Important!", |
| 38 | + importantNote: "Please click on the \"WikiBhasha (Beta)\" bookmarklet again when you are in the target language Wikipedia!", |
| 39 | + contributeBtn: "Contribute to its version in another language", |
| 40 | + articleTitle: "Article Title", |
| 41 | + searchTabTitle: "Search for source article", |
| 42 | + contributeTo: "Enhance existing article in target language", |
| 43 | + create: "Create new article in the target language", |
| 44 | + space: " ", |
| 45 | + dot: ".", |
| 46 | + themeBlue: "Theme Blue", |
| 47 | + themeBlack: "Theme Black", |
| 48 | + themeSilver: "Theme Silver", |
| 49 | + help: "Help", |
| 50 | + maximize: "Maximize", |
| 51 | + close: "Close", |
| 52 | + sourceArticle: "Source Article", |
| 53 | + search: "Search", |
| 54 | + historyLabel: "Visited Topics", |
| 55 | + translate: "Translate to", |
| 56 | + scratchPad: "Scratch Pad", |
| 57 | + searchHeader: "Search", |
| 58 | + convertEntireArticle: "Get the entire article from Source", |
| 59 | + emptySearchResult: "There were no results matching the query.", |
| 60 | + english: "English", |
| 61 | + toText: "to", |
| 62 | + bringContentFromPane: "Bring the translated & corrected source content", |
| 63 | + articleAlreadyExists: "An article with title '{0}' already exists in target language Wikipedia, do you want to edit this page?", |
| 64 | + emptySearchResult: "There were no results matching the query.", |
| 65 | + emptySource: "No Inter-wiki-linked English article exists, for the topic you are working on currently. You may want to search for appropriate material using the ‘Search’ feature.", |
| 66 | + emptyInputText: "Please enter a valid text and continue.", |
| 67 | + unSupportedLanguage: "This target language is not currently supported in WikiBhasha.", |
| 68 | + invalidBookmarklet: "Please select appropriate book marklet", |
| 69 | + defaultLanguageText: "Select Language", |
| 70 | + warningMsg: "Please save your work", |
| 71 | + clearAll: "Clear All", |
| 72 | + sourceTextHeader: "Source Text", |
| 73 | + translatedTextHeader: "Translated Text", |
| 74 | + loadingElementContent: "Loading article...", |
| 75 | + sourceArticleNotApplicable: "Source language content is not applicable here.", |
| 76 | + scratchPadTextLimitConfirmMsg: "The entered text exceeds given limit of {0} characters.\n\nIf you continue to translate, it will discard the text that is beyond the limit", |
| 77 | + scratchPadTextLimitNote: "Maximum characters allowed per translation are {0} characters", |
| 78 | + feedbackTextLimitNote: "[Maximum of {0} characters]", |
| 79 | + feedbackThankYouMessage: "Thank you for the feedback.", |
| 80 | + feedbackErrorMessage: "Could not submit your feedback.<br/><br/>Click <a href='javascript:;' id='feedbackEmailLink'>here</a> to submit via e-mail.", |
| 81 | + feedbackEmptyTextAlertMessage: "Please select one option or enter some text in the provided text area.", |
| 82 | + warningSaveComposeChanges: "Any changes made in this step would be lost if you move to an earlier step. Do you want to move anyway?", |
| 83 | + noTargetLanguageArticleFound: "Linked article not found in target language Wikipedia.", |
| 84 | + feedbackQuestionMessage: "Before leaving WikiBhasha, would you like to give us feedback?", |
| 85 | + previewErrorMessage: "Unable to show the preview.", |
| 86 | + loadingPreviewContent: "Loading Preview...", |
87 | 87 | |
88 | | - //tooptip strings |
89 | | - searchInputTooltip: "Search", |
90 | | - collapseTooltip: "Collapse", |
91 | | - expandPaneTooltip: "Expand", |
| 88 | + //tooptip strings |
| 89 | + searchInputTooltip: "Search", |
| 90 | + collapseTooltip: "Collapse", |
| 91 | + expandPaneTooltip: "Expand", |
92 | 92 | |
93 | | - //help tutorials array[slideNo,text] |
94 | | - tutorials: ["Welcome to WikiBhasha beta, a collaborative tool that helps Wikipedia user communities enhance" + |
95 | | - " content in their respective language Wikipedias. WikiBhasha started as a research project in" + |
96 | | - " Microsoft Research. It is now being made available as an open source project on MediaWiki." + |
97 | | - " The tools is also available as a user gadget in Wikipedia as well as a bookmarklet from" + |
98 | | - " <a href=\"http://www.wikibhasha.org/\" class=\"external\">www.WikiBhasha.org</a>. Please comply with Wikipedia’s norms" + |
99 | | - " for content contribution." + |
100 | | - "<br><br>" + |
101 | | - "Current WikiBhasha beta version: 1.0.0<br><br>" + |
102 | | - "<a href=\"mailto:wikibfb@microsoft.com?subject=WikiBhasha beta Feedback\">Feedback to WikiBhasha team</a> welcome.", |
103 | | - "<b>Supported Platforms: </b><P><P>\tIE 7/8 on Windows XP/Vista/Win7 and " + |
104 | | - "Firefox 3.5 or above on Linux Fedora 11/12. " + |
105 | | - "<b><P><P> Supported Languages: </b><P><P>\t" + |
106 | | - "Currently WikiBhasha (Beta) supports all language pairs supported by" + |
107 | | - " <a href=\"http://www.microsofttranslator.com/\" class=\"external\">Microsoft Translator</a> (where" + |
108 | | - " the source language is English)<P><P>" |
109 | | - ], |
110 | | - nonWikiDomainMsg: "Please select a valid article from wikipedia and invoke WikiBhasha.", |
111 | | - noSourceArticleFound: "In English Wikipedia, WikiBhasha may be invoked only on an existing article.", |
112 | | - waitUntilTranslationComplete: "Please wait till the translation completes.", |
113 | | - thanksMessage: "Thank you for your contribution to Wikipedia. Would you like to give feedback?", |
114 | | - nonEditableMessage: "WikiBhasha may be invoked only on editable articles; this article is protected in Wikipedia." |
115 | | - }; |
116 | | - |
117 | | - //short cut to call local strings |
118 | | - wbLocal = wikiBhasha.localStrings; |
119 | | - |
| 93 | + //help tutorials array[slideNo,text] |
| 94 | + tutorials: ["Welcome to WikiBhasha beta, a collaborative tool that helps Wikipedia user communities enhance" + |
| 95 | + " content in their respective language Wikipedias. WikiBhasha started as a research project in" + |
| 96 | + " Microsoft Research. It is now being made available as an open source project on MediaWiki." + |
| 97 | + " The tools is also available as a user gadget in Wikipedia as well as a bookmarklet from" + |
| 98 | + " <a href=\"http://www.wikibhasha.org/\" class=\"external\">www.WikiBhasha.org</a>. Please comply with Wikipedia’s norms" + |
| 99 | + " for content contribution." + |
| 100 | + "<br><br>" + |
| 101 | + "Current WikiBhasha beta version: 1.0.0<br><br>" + |
| 102 | + "<a href=\"mailto:wikibfb@microsoft.com?subject=WikiBhasha beta Feedback\">Feedback to WikiBhasha team</a> welcome.", |
| 103 | + "<b>Supported Platforms: </b><P><P>\tIE 7/8 on Windows XP/Vista/Win7 and " + |
| 104 | + "Firefox 3.5 or above on Linux Fedora 11/12. " + |
| 105 | + "<b><P><P> Supported Languages: </b><P><P>\t" + |
| 106 | + "Currently WikiBhasha (Beta) supports all language pairs supported by" + |
| 107 | + " <a href=\"http://www.microsofttranslator.com/\" class=\"external\">Microsoft Translator</a> (where" + |
| 108 | + " the source language is English)<P><P>" |
| 109 | + ], |
| 110 | + nonWikiDomainMsg: "Please select a valid article from wikipedia and invoke WikiBhasha.", |
| 111 | + noSourceArticleFound: "In English Wikipedia, WikiBhasha may be invoked only on an existing article.", |
| 112 | + waitUntilTranslationComplete: "Please wait till the translation completes.", |
| 113 | + thanksMessage: "Thank you for your contribution to Wikipedia. Would you like to give feedback?", |
| 114 | + nonEditableMessage: "WikiBhasha may be invoked only on editable articles; this article is protected in Wikipedia." |
| 115 | + }; |
| 116 | + |
| 117 | + //short cut to call local strings |
| 118 | + wbLocal = wikiBhasha.localStrings; |
| 119 | + |
120 | 120 | })(); |
Index: trunk/extensions/WikiBhasha/src/lang/fr/strings.js |
— | — | @@ -21,97 +21,97 @@ |
22 | 22 | */ |
23 | 23 | (function() { |
24 | 24 | |
25 | | - wikiBhasha.localStrings = { |
| 25 | + wikiBhasha.localStrings = { |
26 | 26 | |
27 | | - failureMsg: "Impossible de démarrer WikiBhasha\n", |
28 | | - collaborativeTitle: "Bienvenue à la beta de WikiBhasha, un outil collaboratif pour améliorer le contenu multilingue de Wikipedia.", |
29 | | - collaborativeSearchTitle: "Entrez des termes à rechercher sur le Wikipedia anglophone et celui de la langue cible.", |
30 | | - currentLanguage1: "Vous êtes actuellement sur l'article ", |
31 | | - currentLanguage2: "du Wikipedia anglophone.", |
32 | | - exit: "Quitter WikiBhasha", |
33 | | - languageArticle: "Choisissez la langue cible.", |
34 | | - detectArticle: "L'article n'existe pas dans la langue ciblé. Indiquez un titre pour le créer.", |
35 | | - existingtArticle: "L'article existe déjà dans la langue cible.", |
36 | | - notApplicableStep: "Cette étape n'est pas applicable à l'article en cours.", |
37 | | - important: "Important !", |
38 | | - importantNote: "Cliquez à nouveau sur le marque-page \"WikiBhasha (Beta)\" lorsque vous serez sur le Wikipedia de la langue cible.", |
39 | | - contributeBtn: "Contribuer à son équivalent dans une autre langue", |
40 | | - articleTitle: "Titre d'Article", |
41 | | - searchTabTitle: "Chercher l'article source", |
42 | | - contributeTo: "Améliorer l'article existant dans la langue cible", |
43 | | - create: "Créer l'article dans la langue cible", |
44 | | - space: " ", |
45 | | - dot: ".", |
46 | | - themeBlue: "Thème Bleu", |
47 | | - themeBlack: "Thème Noir", |
48 | | - themeSilver: "Thème Argent", |
49 | | - help: "Aide", |
50 | | - maximize: "Agrandir", |
51 | | - close: "Fermer", |
52 | | - sourceArticle: "Article Source", |
53 | | - search: "Chercher", |
54 | | - historyLabel: "Sujets visités", |
55 | | - translate: "Traduire en", |
56 | | - scratchPad: "Scratch Pad", |
57 | | - searchHeader: "Recherche", |
58 | | - convertEntireArticle: "Récupérer l'article de la Source", |
59 | | - emptySearchResult: "Aucun résultat pour la requête.", |
60 | | - english: "Anglais", |
61 | | - toText: "en", |
62 | | - bringContentFromPane: "Apporter le contenu traduit et corrigé", |
63 | | - articleAlreadyExists: "Un article avec le titre '{0}' existe déjà dans le Wikipedia cible, souhaitez-vous éditer cette page ?", |
64 | | - emptySearchResult: "Aucun résultat pour la recherche.", |
65 | | - emptySource: "L'interwiki pour l'anglais n'existe pas. Recherchez un article approprié.", |
66 | | - emptyInputText: "Entrez un texte valide et continuez.", |
67 | | - unSupportedLanguage: "La langue cible n'est pas supportée par WikiBasha pour le moment.", |
68 | | - invalidBookmarklet: "Choisissez un autre marque-page", |
69 | | - defaultLanguageText: "Choix de langue", |
70 | | - warningMsg: "Merci d'enregistrer votre travail", |
71 | | - clearAll: "Tout Vider", |
72 | | - sourceTextHeader: "Texte Source", |
73 | | - translatedTextHeader: "Texte Traduit", |
74 | | - loadingElementContent: "Chargement de l'article ...", |
75 | | - sourceArticleNotApplicable: "Le contenu de la langue source n'est pas applicable ici..", |
76 | | - scratchPadTextLimitConfirmMsg: "Le texte entré dépasse la limite de {0} caractères.\n\nSi vous poursuivez votre traduction, vous détruirez le texte qui dépasse cette limite", |
77 | | - scratchPadTextLimitNote: "Chaque traduction est limitée à {0} caractères maximum.", |
78 | | - feedbackTextLimitNote: "[Maximum de {0} caractères]", |
79 | | - feedbackThankYouMessage: "Merci pour votre avis!", |
80 | | - feedbackErrorMessage: "Impossible d'envoyer votre avis.<br/><br/>Cliquez <a href='javascript:;' id='feedbackEmailLink'>ici</a> pour l'envoyer par courriel.", |
81 | | - feedbackEmptyTextAlertMessage: "Choisissez une option ou entrez du texte.", |
82 | | - warningSaveComposeChanges: "Tout changement réalisé lors de cette étape sera perdu si vous revenez à une étape précédente. Voulez-vous tout de même revenir en arrière ?", |
83 | | - noTargetLanguageArticleFound: "Article lié introuvable dans le Wikipedia de la langue cible.", |
84 | | - feedbackQuestionMessage: "Avant de quitter WikiBhasha, voulez-vous nous donner votre avis ?", |
| 27 | + failureMsg: "Impossible de démarrer WikiBhasha\n", |
| 28 | + collaborativeTitle: "Bienvenue à la beta de WikiBhasha, un outil collaboratif pour améliorer le contenu multilingue de Wikipedia.", |
| 29 | + collaborativeSearchTitle: "Entrez des termes à rechercher sur le Wikipedia anglophone et celui de la langue cible.", |
| 30 | + currentLanguage1: "Vous êtes actuellement sur l'article ", |
| 31 | + currentLanguage2: "du Wikipedia anglophone.", |
| 32 | + exit: "Quitter WikiBhasha", |
| 33 | + languageArticle: "Choisissez la langue cible.", |
| 34 | + detectArticle: "L'article n'existe pas dans la langue ciblé. Indiquez un titre pour le créer.", |
| 35 | + existingtArticle: "L'article existe déjà dans la langue cible.", |
| 36 | + notApplicableStep: "Cette étape n'est pas applicable à l'article en cours.", |
| 37 | + important: "Important !", |
| 38 | + importantNote: "Cliquez à nouveau sur le marque-page \"WikiBhasha (Beta)\" lorsque vous serez sur le Wikipedia de la langue cible.", |
| 39 | + contributeBtn: "Contribuer à son équivalent dans une autre langue", |
| 40 | + articleTitle: "Titre d'Article", |
| 41 | + searchTabTitle: "Chercher l'article source", |
| 42 | + contributeTo: "Améliorer l'article existant dans la langue cible", |
| 43 | + create: "Créer l'article dans la langue cible", |
| 44 | + space: " ", |
| 45 | + dot: ".", |
| 46 | + themeBlue: "Thème Bleu", |
| 47 | + themeBlack: "Thème Noir", |
| 48 | + themeSilver: "Thème Argent", |
| 49 | + help: "Aide", |
| 50 | + maximize: "Agrandir", |
| 51 | + close: "Fermer", |
| 52 | + sourceArticle: "Article Source", |
| 53 | + search: "Chercher", |
| 54 | + historyLabel: "Sujets visités", |
| 55 | + translate: "Traduire en", |
| 56 | + scratchPad: "Scratch Pad", |
| 57 | + searchHeader: "Recherche", |
| 58 | + convertEntireArticle: "Récupérer l'article de la Source", |
| 59 | + emptySearchResult: "Aucun résultat pour la requête.", |
| 60 | + english: "Anglais", |
| 61 | + toText: "en", |
| 62 | + bringContentFromPane: "Apporter le contenu traduit et corrigé", |
| 63 | + articleAlreadyExists: "Un article avec le titre '{0}' existe déjà dans le Wikipedia cible, souhaitez-vous éditer cette page ?", |
| 64 | + emptySearchResult: "Aucun résultat pour la recherche.", |
| 65 | + emptySource: "L'interwiki pour l'anglais n'existe pas. Recherchez un article approprié.", |
| 66 | + emptyInputText: "Entrez un texte valide et continuez.", |
| 67 | + unSupportedLanguage: "La langue cible n'est pas supportée par WikiBasha pour le moment.", |
| 68 | + invalidBookmarklet: "Choisissez un autre marque-page", |
| 69 | + defaultLanguageText: "Choix de langue", |
| 70 | + warningMsg: "Merci d'enregistrer votre travail", |
| 71 | + clearAll: "Tout Vider", |
| 72 | + sourceTextHeader: "Texte Source", |
| 73 | + translatedTextHeader: "Texte Traduit", |
| 74 | + loadingElementContent: "Chargement de l'article ...", |
| 75 | + sourceArticleNotApplicable: "Le contenu de la langue source n'est pas applicable ici..", |
| 76 | + scratchPadTextLimitConfirmMsg: "Le texte entré dépasse la limite de {0} caractères.\n\nSi vous poursuivez votre traduction, vous détruirez le texte qui dépasse cette limite", |
| 77 | + scratchPadTextLimitNote: "Chaque traduction est limitée à {0} caractères maximum.", |
| 78 | + feedbackTextLimitNote: "[Maximum de {0} caractères]", |
| 79 | + feedbackThankYouMessage: "Merci pour votre avis!", |
| 80 | + feedbackErrorMessage: "Impossible d'envoyer votre avis.<br/><br/>Cliquez <a href='javascript:;' id='feedbackEmailLink'>ici</a> pour l'envoyer par courriel.", |
| 81 | + feedbackEmptyTextAlertMessage: "Choisissez une option ou entrez du texte.", |
| 82 | + warningSaveComposeChanges: "Tout changement réalisé lors de cette étape sera perdu si vous revenez à une étape précédente. Voulez-vous tout de même revenir en arrière ?", |
| 83 | + noTargetLanguageArticleFound: "Article lié introuvable dans le Wikipedia de la langue cible.", |
| 84 | + feedbackQuestionMessage: "Avant de quitter WikiBhasha, voulez-vous nous donner votre avis ?", |
85 | 85 | |
86 | | - //tooptip strings |
87 | | - searchInputTooltip: "Recherche", |
88 | | - collapseTooltip: "Réduire", |
89 | | - expandPaneTooltip: "Agrandir", |
| 86 | + //tooptip strings |
| 87 | + searchInputTooltip: "Recherche", |
| 88 | + collapseTooltip: "Réduire", |
| 89 | + expandPaneTooltip: "Agrandir", |
90 | 90 | |
91 | | - //help tutorials array[slideNo,text] |
92 | | - tutorials: [" Bienvenue dans WikiBhasha beta, un outil collaboratif qui aide les communautés de Wikipedia" + |
93 | | - " à améliorer leur contenu dans leur langues respectives. WikiBhasha était un projet de recherche" + |
94 | | - " de Microsoft Research. Il est maintenant mis à disposition en tant que projet open source" + |
95 | | - " de MediaWiki. L'outil est également disponible en tant que gadget utilisateur sur Wikipedia" + |
96 | | - " et en tant que marque-page sur <a href=\"http://www.wikibhasha.org/\" class=\"external\">www.WikiBhasha.org</a>." + |
97 | | - " Merci de respecter les règles de Wikipedia pour en distribuer le contenu." + |
98 | | - "<br/><br/>" + |
99 | | - "Version en cours de WikiBhasha beta : 1.0.0<br/><br/>" + |
100 | | - //"<a href=\"mailto:wikibfb@microsoft.com?subject=WikiBhasha beta Feedback\">Feedback to WikiBhasha team</a> welcome.", |
101 | | - "<b>Plateformes supportées : </b><P><P>\tIE 7/8 sur Windows XP/Vista/Win7 et " + |
102 | | - "Firefox 3.5 ou suivant sur Linux Fedora 11/12. " + |
103 | | - "<b><P><P> Langues supportées : </b><P><P>\t" + |
104 | | - "Actuellement, WikiBhasha (Beta) supporte toutes les paires de langues gérées par " + |
105 | | - " <a href=\"http://www.microsofttranslator.com/\" class=\"external\">Microsoft Translator</a>" + |
106 | | - " où la langue source est l'anlais<P><P>" |
107 | | - ], |
108 | | - nonWikiDomainMsg: "Choisissez un article valide de Wikipedia et lancez WikiBhasha.", |
109 | | - noSourceArticleFound: "Sur le Wikipedia anglais, WikiBhasha ne peut être utilisé que sur des articles existants.", |
110 | | - waitUntilTranslationComplete: "Patientez jusqu'à ce que la traduction soit complète.", |
111 | | - thanksMessage: "Merci pour votre contribution à Wikipedia. Voulez-vous nous donner votre avis ?", |
112 | | - nonEditableMessage: "WikiBhasha ne peut être utiliser que sur des articles éditable; celui-ci est protégé sur Wikipedia." |
113 | | - }; |
114 | | - |
115 | | - //short cut to call local strings |
116 | | - wbLocal = wikiBhasha.localStrings; |
117 | | - |
| 91 | + //help tutorials array[slideNo,text] |
| 92 | + tutorials: [" Bienvenue dans WikiBhasha beta, un outil collaboratif qui aide les communautés de Wikipedia" + |
| 93 | + " à améliorer leur contenu dans leur langues respectives. WikiBhasha était un projet de recherche" + |
| 94 | + " de Microsoft Research. Il est maintenant mis à disposition en tant que projet open source" + |
| 95 | + " de MediaWiki. L'outil est également disponible en tant que gadget utilisateur sur Wikipedia" + |
| 96 | + " et en tant que marque-page sur <a href=\"http://www.wikibhasha.org/\" class=\"external\">www.WikiBhasha.org</a>." + |
| 97 | + " Merci de respecter les règles de Wikipedia pour en distribuer le contenu." + |
| 98 | + "<br/><br/>" + |
| 99 | + "Version en cours de WikiBhasha beta : 1.0.0<br/><br/>" + |
| 100 | + //"<a href=\"mailto:wikibfb@microsoft.com?subject=WikiBhasha beta Feedback\">Feedback to WikiBhasha team</a> welcome.", |
| 101 | + "<b>Plateformes supportées : </b><P><P>\tIE 7/8 sur Windows XP/Vista/Win7 et " + |
| 102 | + "Firefox 3.5 ou suivant sur Linux Fedora 11/12. " + |
| 103 | + "<b><P><P> Langues supportées : </b><P><P>\t" + |
| 104 | + "Actuellement, WikiBhasha (Beta) supporte toutes les paires de langues gérées par " + |
| 105 | + " <a href=\"http://www.microsofttranslator.com/\" class=\"external\">Microsoft Translator</a>" + |
| 106 | + " où la langue source est l'anlais<P><P>" |
| 107 | + ], |
| 108 | + nonWikiDomainMsg: "Choisissez un article valide de Wikipedia et lancez WikiBhasha.", |
| 109 | + noSourceArticleFound: "Sur le Wikipedia anglais, WikiBhasha ne peut être utilisé que sur des articles existants.", |
| 110 | + waitUntilTranslationComplete: "Patientez jusqu'à ce que la traduction soit complète.", |
| 111 | + thanksMessage: "Merci pour votre contribution à Wikipedia. Voulez-vous nous donner votre avis ?", |
| 112 | + nonEditableMessage: "WikiBhasha ne peut être utiliser que sur des articles éditable; celui-ci est protégé sur Wikipedia." |
| 113 | + }; |
| 114 | + |
| 115 | + //short cut to call local strings |
| 116 | + wbLocal = wikiBhasha.localStrings; |
| 117 | + |
118 | 118 | })(); |
Index: trunk/extensions/WikiBhasha/src/lang/de/strings.js |
— | — | @@ -20,99 +20,99 @@ |
21 | 21 | |
22 | 22 | (function() { |
23 | 23 | |
24 | | - wikiBhasha.localStrings = { |
| 24 | + wikiBhasha.localStrings = { |
25 | 25 | |
26 | | - failureMsg: "Unable to launch WikiBhasha\n", |
27 | | - collaborativeTitle: "Welcome to WikiBhasha beta, a collaborative tool for enhancing multilingual content in Wikipedias.", |
28 | | - collaborativeSearchTitle: "Please input terms to search for within English and the target language Wikipedias.", |
29 | | - currentLanguage1: "You are currently on the", |
30 | | - currentLanguage2: "article in the English Wikipedia.", |
31 | | - exit: "Exit WikiBhasha", |
32 | | - languageArticle: "Select the target language.", |
33 | | - detectArticle: "This article does not exist in the target language Wikpedia. Please provide a title to create one.", |
34 | | - existingtArticle: "This article already exists in the target language.", |
35 | | - notApplicableStep: "This step in not applicable for current article.", |
36 | | - important: "Important!", |
37 | | - importantNote: "Please click on the \"WikiBhasha (Beta)\" bookmarklet again when you are in the target language Wikipedia!", |
38 | | - contributeBtn: "Contribute to its version in another language", |
39 | | - articleTitle: "Article Title", |
40 | | - searchTabTitle: "Search for source article", |
41 | | - contributeTo: "Enhance existing article in target language", |
42 | | - create: "Create new article in the target langauge", |
43 | | - space: " ", |
44 | | - dot: ".", |
45 | | - themeBlue: "Theme Blue", |
46 | | - themeBlack: "Theme Black", |
47 | | - themeSilver: "Theme Silver", |
48 | | - help: "Help", |
49 | | - maximize: "Maximize", |
50 | | - close: "Close", |
51 | | - sourceArticle: "Source Article", |
52 | | - search: "Search", |
53 | | - historyLabel: "Visited Topics", |
54 | | - translate: "Translate to", |
55 | | - scratchPad: "Scratch Pad", |
56 | | - searchHeader: "Search", |
57 | | - convertEntireArticle: "Get the entire article from Source", |
58 | | - emptySearchResult: "There were no results matching the query.", |
59 | | - english: "English", |
60 | | - toText: "to", |
61 | | - bringContentFromPane: "Bring the translated & corrected source content", |
62 | | - articleAlreadyExists: "An article with title '{0}' already exists in target language Wikipedia, do you want to edit this page?", |
63 | | - emptySearchResult: "There were no results matching the query.", |
64 | | - emptySource: "No Inter-wiki-linked English article exists, for the topic you are working on currently. You may want to search for appropriate material using the ‘Search’ feature.", |
65 | | - emptyInputText: "Please enter a valid text and continue.", |
66 | | - unSupportedLanguage: "This target language is not currently supported in WikiBhasha.", |
67 | | - invalidBookmarklet: "Please select appropriate book marklet", |
68 | | - defaultLanguageText: "Select Language", |
69 | | - warningMsg: "Please save your work", |
70 | | - clearAll: "Clear All", |
71 | | - sourceTextHeader: "Source Text", |
72 | | - translatedTextHeader: "Translated Text", |
73 | | - loadingElementContent: "Loading article...", |
74 | | - sourceArticleNotApplicable: "Source langauge content is not applicable here.", |
75 | | - scratchPadTextLimitConfirmMsg: "The entered text exceeds given limit of {0} characters.\n\nIf you continue to translate, it will discard the text that is beyond the limit", |
76 | | - scratchPadTextLimitNote: "Maximum characters allowed per translation are {0} characters", |
77 | | - feedbackTextLimitNote: "[Maximum of {0} characters]", |
78 | | - feedbackThankYouMessage: "Thank you for the feedback.", |
79 | | - feedbackErrorMessage: "Could not submit your feedback.<br/><br/>Click <a href='javascript:;' id='feedbackEmailLink'>here</a> to submit via e-mail.", |
80 | | - feedbackEmptyTextAlertMessage: "Please select one option or enter some text in the provided text area.", |
81 | | - warningSaveComposeChanges: "Any changes made in this step would be lost if you move to an earlier step. Do you want to move anyway?", |
82 | | - noTargetLanguageArticleFound: "Linked article not found in target language Wikipedia.", |
83 | | - feedbackQuestionMessage: "Before leaving WikiBhasha, would you like to give us feedback?", |
84 | | - previewErrorMessage: "Unable to show the preview.", |
85 | | - loadingPreviewContent: "Loading Preview...", |
| 26 | + failureMsg: "Unable to launch WikiBhasha\n", |
| 27 | + collaborativeTitle: "Welcome to WikiBhasha beta, a collaborative tool for enhancing multilingual content in Wikipedias.", |
| 28 | + collaborativeSearchTitle: "Please input terms to search for within English and the target language Wikipedias.", |
| 29 | + currentLanguage1: "You are currently on the", |
| 30 | + currentLanguage2: "article in the English Wikipedia.", |
| 31 | + exit: "Exit WikiBhasha", |
| 32 | + languageArticle: "Select the target language.", |
| 33 | + detectArticle: "This article does not exist in the target language Wikpedia. Please provide a title to create one.", |
| 34 | + existingtArticle: "This article already exists in the target language.", |
| 35 | + notApplicableStep: "This step in not applicable for current article.", |
| 36 | + important: "Important!", |
| 37 | + importantNote: "Please click on the \"WikiBhasha (Beta)\" bookmarklet again when you are in the target language Wikipedia!", |
| 38 | + contributeBtn: "Contribute to its version in another language", |
| 39 | + articleTitle: "Article Title", |
| 40 | + searchTabTitle: "Search for source article", |
| 41 | + contributeTo: "Enhance existing article in target language", |
| 42 | + create: "Create new article in the target langauge", |
| 43 | + space: " ", |
| 44 | + dot: ".", |
| 45 | + themeBlue: "Theme Blue", |
| 46 | + themeBlack: "Theme Black", |
| 47 | + themeSilver: "Theme Silver", |
| 48 | + help: "Help", |
| 49 | + maximize: "Maximize", |
| 50 | + close: "Close", |
| 51 | + sourceArticle: "Source Article", |
| 52 | + search: "Search", |
| 53 | + historyLabel: "Visited Topics", |
| 54 | + translate: "Translate to", |
| 55 | + scratchPad: "Scratch Pad", |
| 56 | + searchHeader: "Search", |
| 57 | + convertEntireArticle: "Get the entire article from Source", |
| 58 | + emptySearchResult: "There were no results matching the query.", |
| 59 | + english: "English", |
| 60 | + toText: "to", |
| 61 | + bringContentFromPane: "Bring the translated & corrected source content", |
| 62 | + articleAlreadyExists: "An article with title '{0}' already exists in target language Wikipedia, do you want to edit this page?", |
| 63 | + emptySearchResult: "There were no results matching the query.", |
| 64 | + emptySource: "No Inter-wiki-linked English article exists, for the topic you are working on currently. You may want to search for appropriate material using the ‘Search’ feature.", |
| 65 | + emptyInputText: "Please enter a valid text and continue.", |
| 66 | + unSupportedLanguage: "This target language is not currently supported in WikiBhasha.", |
| 67 | + invalidBookmarklet: "Please select appropriate book marklet", |
| 68 | + defaultLanguageText: "Select Language", |
| 69 | + warningMsg: "Please save your work", |
| 70 | + clearAll: "Clear All", |
| 71 | + sourceTextHeader: "Source Text", |
| 72 | + translatedTextHeader: "Translated Text", |
| 73 | + loadingElementContent: "Loading article...", |
| 74 | + sourceArticleNotApplicable: "Source langauge content is not applicable here.", |
| 75 | + scratchPadTextLimitConfirmMsg: "The entered text exceeds given limit of {0} characters.\n\nIf you continue to translate, it will discard the text that is beyond the limit", |
| 76 | + scratchPadTextLimitNote: "Maximum characters allowed per translation are {0} characters", |
| 77 | + feedbackTextLimitNote: "[Maximum of {0} characters]", |
| 78 | + feedbackThankYouMessage: "Thank you for the feedback.", |
| 79 | + feedbackErrorMessage: "Could not submit your feedback.<br/><br/>Click <a href='javascript:;' id='feedbackEmailLink'>here</a> to submit via e-mail.", |
| 80 | + feedbackEmptyTextAlertMessage: "Please select one option or enter some text in the provided text area.", |
| 81 | + warningSaveComposeChanges: "Any changes made in this step would be lost if you move to an earlier step. Do you want to move anyway?", |
| 82 | + noTargetLanguageArticleFound: "Linked article not found in target language Wikipedia.", |
| 83 | + feedbackQuestionMessage: "Before leaving WikiBhasha, would you like to give us feedback?", |
| 84 | + previewErrorMessage: "Unable to show the preview.", |
| 85 | + loadingPreviewContent: "Loading Preview...", |
86 | 86 | |
87 | | - //tooptip strings |
88 | | - searchInputTooltip: "Search", |
89 | | - collapseTooltip: "Collapse", |
90 | | - expandPaneTooltip: "Expand", |
| 87 | + //tooptip strings |
| 88 | + searchInputTooltip: "Search", |
| 89 | + collapseTooltip: "Collapse", |
| 90 | + expandPaneTooltip: "Expand", |
91 | 91 | |
92 | | - //help tutorials array[slideNo,text] |
93 | | - tutorials: ["Welcome to WikiBhasha beta, a collaborative tool that helps Wikipedia user communities enhance" + |
94 | | - " content in their respective language Wikipedias. WikiBhasha started as a research project in" + |
95 | | - " Microsoft Research. It is now being made available as an open source project on MediaWiki." + |
96 | | - " The tools is also available as a user gadget in Wikipedia as well as a bookmarklet from" + |
97 | | - " <a href=\"www.wikibhasha.org\">www.WikiBhasha.org</a>. Please comply with Wikipedia’s norms" + |
98 | | - " for content contribution." + |
99 | | - "<br><br>" + |
100 | | - "Current WikiBhasha beta version: 1.0.0<br><br>" + |
101 | | - "<a href=\"mailto:wikibfb@microsoft.com?subject=WikiBhasha beta Feedback\">Feedback to WikiBhasha team</a> welcome.", |
102 | | - "<b>Supported Platforms: </b><P><P>\tIE 7/8 on Windows XP/Vista/Win7 and " + |
103 | | - "Firefox 3.5 or above on Linux Fedora 11/12. " + |
104 | | - "<b><P><P> Supported Languages: </b><P><P>\t" + |
105 | | - "Currently WikiBhasha (Beta) supports all language pairs supported by" + |
106 | | - " <a href=' http://www.microsofttranslator.com' target='_BLANK'>Microsoft Translator</a> (where" + |
107 | | - " the source language is English)<P><P>" |
108 | | - ], |
109 | | - nonWikiDomainMsg: "Please select a valid article from wikipedia and invoke WikiBhasha.", |
110 | | - noSourceArticleFound: "In English Wikipedia, WikiBhasha may be invoked only on an existing article.", |
111 | | - waitUntilTranslationComplete: "Please wait till the translation completes.", |
112 | | - thanksMessage: "Thank you for your contribution to Wikipedia. Would you like to give feedback?", |
113 | | - nonEditableMessage: "WikiBhasha may be invoked only on editable articles; this article is protected in Wikipedia." |
114 | | - }; |
| 92 | + //help tutorials array[slideNo,text] |
| 93 | + tutorials: ["Welcome to WikiBhasha beta, a collaborative tool that helps Wikipedia user communities enhance" + |
| 94 | + " content in their respective language Wikipedias. WikiBhasha started as a research project in" + |
| 95 | + " Microsoft Research. It is now being made available as an open source project on MediaWiki." + |
| 96 | + " The tools is also available as a user gadget in Wikipedia as well as a bookmarklet from" + |
| 97 | + " <a href=\"www.wikibhasha.org\">www.WikiBhasha.org</a>. Please comply with Wikipedia’s norms" + |
| 98 | + " for content contribution." + |
| 99 | + "<br><br>" + |
| 100 | + "Current WikiBhasha beta version: 1.0.0<br><br>" + |
| 101 | + "<a href=\"mailto:wikibfb@microsoft.com?subject=WikiBhasha beta Feedback\">Feedback to WikiBhasha team</a> welcome.", |
| 102 | + "<b>Supported Platforms: </b><P><P>\tIE 7/8 on Windows XP/Vista/Win7 and " + |
| 103 | + "Firefox 3.5 or above on Linux Fedora 11/12. " + |
| 104 | + "<b><P><P> Supported Languages: </b><P><P>\t" + |
| 105 | + "Currently WikiBhasha (Beta) supports all language pairs supported by" + |
| 106 | + " <a href=' http://www.microsofttranslator.com' target='_BLANK'>Microsoft Translator</a> (where" + |
| 107 | + " the source language is English)<P><P>" |
| 108 | + ], |
| 109 | + nonWikiDomainMsg: "Please select a valid article from wikipedia and invoke WikiBhasha.", |
| 110 | + noSourceArticleFound: "In English Wikipedia, WikiBhasha may be invoked only on an existing article.", |
| 111 | + waitUntilTranslationComplete: "Please wait till the translation completes.", |
| 112 | + thanksMessage: "Thank you for your contribution to Wikipedia. Would you like to give feedback?", |
| 113 | + nonEditableMessage: "WikiBhasha may be invoked only on editable articles; this article is protected in Wikipedia." |
| 114 | + }; |
115 | 115 | |
116 | | - //short cut to call local strings |
117 | | - wbLocal = wikiBhasha.localStrings; |
| 116 | + //short cut to call local strings |
| 117 | + wbLocal = wikiBhasha.localStrings; |
118 | 118 | |
119 | 119 | })(); |
Index: trunk/extensions/WikiBhasha/src/js/main.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | |
30 | 30 | //make sure the base namespace exists. |
31 | 31 | if (typeof (wikiBhasha) === "undefined") { |
32 | | - wikiBhasha = {}; |
| 32 | + wikiBhasha = {}; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // settings for enabling debug mode to get asserts & debug breaks when an assert expression fails. |
— | — | @@ -36,143 +36,143 @@ |
37 | 37 | wikiBhasha.debugMode = false; |
38 | 38 | wikiBhasha.debugHelper = {}; |
39 | 39 | wikiBhasha.debugHelper.assertExpr = (wikiBhasha.debugMode) ? |
40 | | - function(expr, message) { if (!expr) { alert(message || "debug assert failed"); debugger; } } |
41 | | - : function() { }; |
| 40 | + function(expr, message) { if (!expr) { alert(message || "debug assert failed"); debugger; } } |
| 41 | + : function() { }; |
42 | 42 | |
43 | 43 | //initiates the application load on UI, once the required JavaScript,CSS and localized strings are loaded. |
44 | 44 | wikiBhasha.loadApplication = function() { |
45 | 45 | |
46 | | - //remove 'loading...' div after successful call of wikiBhasha. |
47 | | - $("#wbLoadDiv").remove(); |
| 46 | + //remove 'loading...' div after successful call of wikiBhasha. |
| 47 | + $("#wbLoadDiv").remove(); |
48 | 48 | |
49 | | - //describes whether current domain is 'Wikipedia' or not. |
50 | | - var isWikipediaDomain = true, |
51 | | - currentLanguageCode = wbWikiSite.getCurrentLanguage(); |
| 49 | + //describes whether current domain is 'Wikipedia' or not. |
| 50 | + var isWikipediaDomain = true, |
| 51 | + currentLanguageCode = wbWikiSite.getCurrentLanguage(); |
52 | 52 | |
53 | | - //set the current domain is Wikipedia or not |
54 | | - isWikipediaDomain = wbWikiSite.isWikiDomain(document.location.href); |
| 53 | + //set the current domain is Wikipedia or not |
| 54 | + isWikipediaDomain = wbWikiSite.isWikiDomain(document.location.href); |
55 | 55 | |
56 | | - //avoid launching of application on non-wiki domain articles and on any special pages from Wikipedia. |
57 | | - if ((wbWikiSite.isWikiMainPage()) || (typeof wbWikiSite.getCurrentArticleTitle() == "undefined") |
58 | | - || (!wbWikiSite.getCurrentArticleTitle()) || wgNamespaceNumber != 0) { |
59 | | - window.alert(wbLocal.nonWikiDomainMsg); |
60 | | - return; |
61 | | - } |
| 56 | + //avoid launching of application on non-wiki domain articles and on any special pages from Wikipedia. |
| 57 | + if ((wbWikiSite.isWikiMainPage()) || (typeof wbWikiSite.getCurrentArticleTitle() == "undefined") |
| 58 | + || (!wbWikiSite.getCurrentArticleTitle()) || wgNamespaceNumber != 0) { |
| 59 | + window.alert(wbLocal.nonWikiDomainMsg); |
| 60 | + return; |
| 61 | + } |
62 | 62 | |
63 | | - //set the direction for the content. Eg: Arabic, Hebrew are with orientation of right to left. |
64 | | - wbGlobalSettings.direction = (wbGlobalSettings.isLanguageRTL(currentLanguageCode)) ? "rtl" : "ltr"; |
| 63 | + //set the direction for the content. Eg: Arabic, Hebrew are with orientation of right to left. |
| 64 | + wbGlobalSettings.direction = (wbGlobalSettings.isLanguageRTL(currentLanguageCode)) ? "rtl" : "ltr"; |
65 | 65 | |
66 | 66 | |
67 | | - //set target language, if current language code is not english |
68 | | - if (currentLanguageCode !== wbGlobalSettings.sourceLanguageCode) { |
69 | | - wbGlobalSettings.targetLanguageCode = currentLanguageCode; |
70 | | - if (currentLanguageCode === 'zh') { |
71 | | - var urlGetMltCode = wbUtil.getQueryStringValue('mltCode'); |
72 | | - if (urlGetMltCode) { |
73 | | - wbGlobalSettings.mtTargetLanguageCode = urlGetMltCode; |
74 | | - } |
75 | | - } else { |
76 | | - wbGlobalSettings.mtTargetLanguageCode = currentLanguageCode; |
77 | | - } |
78 | | - } |
| 67 | + //set target language, if current language code is not english |
| 68 | + if (currentLanguageCode !== wbGlobalSettings.sourceLanguageCode) { |
| 69 | + wbGlobalSettings.targetLanguageCode = currentLanguageCode; |
| 70 | + if (currentLanguageCode === 'zh') { |
| 71 | + var urlGetMltCode = wbUtil.getQueryStringValue('mltCode'); |
| 72 | + if (urlGetMltCode) { |
| 73 | + wbGlobalSettings.mtTargetLanguageCode = urlGetMltCode; |
| 74 | + } |
| 75 | + } else { |
| 76 | + wbGlobalSettings.mtTargetLanguageCode = currentLanguageCode; |
| 77 | + } |
| 78 | + } |
79 | 79 | |
80 | | - if (isWikipediaDomain) { |
| 80 | + if (isWikipediaDomain) { |
81 | 81 | |
82 | | - if (currentLanguageCode === 'en' && !wgArticleId) { |
83 | | - //check if the user clicked title exists in Wikipedia or not |
84 | | - wbUIHelper.hideLightBox(); |
85 | | - window.alert(wbLocal.noSourceArticleFound); |
86 | | - return false; |
87 | | - } |
| 82 | + if (currentLanguageCode === 'en' && !wgArticleId) { |
| 83 | + //check if the user clicked title exists in Wikipedia or not |
| 84 | + wbUIHelper.hideLightBox(); |
| 85 | + window.alert(wbLocal.noSourceArticleFound); |
| 86 | + return false; |
| 87 | + } |
88 | 88 | |
89 | | - //display language selection window if current article language code and target article language code both are english |
90 | | - if (currentLanguageCode == wbGlobalSettings.sourceLanguageCode) { |
91 | | - try { |
92 | | - wbUIHelper.hideScroll(); |
93 | | - wbUIHelper.showLightBox(); |
| 89 | + //display language selection window if current article language code and target article language code both are english |
| 90 | + if (currentLanguageCode == wbGlobalSettings.sourceLanguageCode) { |
| 91 | + try { |
| 92 | + wbUIHelper.hideScroll(); |
| 93 | + wbUIHelper.showLightBox(); |
94 | 94 | |
95 | | - //display language selection window |
96 | | - //if application is launched in source language article from the same language application link |
97 | | - if (wbGlobalSettings.targetLanguageCode == wbGlobalSettings.sourceLanguageCode) { |
98 | | - wikiBhasha.windowManagement.languageSelectionWindow.show(true /*show the language dropdown*/); |
99 | | - } |
100 | | - else { |
101 | | - wikiBhasha.windowManagement.languageSelectionWindow.show(false /*hide the language dropdown*/); |
102 | | - } |
103 | | - return; |
104 | | - } |
105 | | - catch (e) { |
106 | | - wbUIHelper.hideLightBox(); |
107 | | - window.alert(wbLocal.failureMsg + "\n" + e); |
108 | | - return; |
109 | | - } |
110 | | - } |
111 | | - //invalid application link clicked, |
112 | | - //if current article language and target language code are different |
113 | | - else if ((currentLanguageCode != wbGlobalSettings.sourceLanguageCode) && |
114 | | - (currentLanguageCode != wbGlobalSettings.targetLanguageCode) && |
115 | | - (wbGlobalSettings.targetLanguageCode != wbGlobalSettings.sourceLanguageCode)) { |
116 | | - wbUIHelper.hideLightBox(); |
117 | | - window.alert(wbLocal.invalidBookmarklet); |
118 | | - return; |
119 | | - } |
120 | | - } |
| 95 | + //display language selection window |
| 96 | + //if application is launched in source language article from the same language application link |
| 97 | + if (wbGlobalSettings.targetLanguageCode == wbGlobalSettings.sourceLanguageCode) { |
| 98 | + wikiBhasha.windowManagement.languageSelectionWindow.show(true /*show the language dropdown*/); |
| 99 | + } |
| 100 | + else { |
| 101 | + wikiBhasha.windowManagement.languageSelectionWindow.show(false /*hide the language dropdown*/); |
| 102 | + } |
| 103 | + return; |
| 104 | + } |
| 105 | + catch (e) { |
| 106 | + wbUIHelper.hideLightBox(); |
| 107 | + window.alert(wbLocal.failureMsg + "\n" + e); |
| 108 | + return; |
| 109 | + } |
| 110 | + } |
| 111 | + //invalid application link clicked, |
| 112 | + //if current article language and target language code are different |
| 113 | + else if ((currentLanguageCode != wbGlobalSettings.sourceLanguageCode) && |
| 114 | + (currentLanguageCode != wbGlobalSettings.targetLanguageCode) && |
| 115 | + (wbGlobalSettings.targetLanguageCode != wbGlobalSettings.sourceLanguageCode)) { |
| 116 | + wbUIHelper.hideLightBox(); |
| 117 | + window.alert(wbLocal.invalidBookmarklet); |
| 118 | + return; |
| 119 | + } |
| 120 | + } |
121 | 121 | |
122 | | - //check the current language is supported by application or not. |
123 | | - if (!(wbGlobalSettings.isWikiBhashaSupportedLanguage(wbGlobalSettings.mtTargetLanguageCode))) { |
124 | | - window.alert(wbLocal.unSupportedLanguage); |
125 | | - return; |
126 | | - } |
| 122 | + //check the current language is supported by application or not. |
| 123 | + if (!(wbGlobalSettings.isWikiBhashaSupportedLanguage(wbGlobalSettings.mtTargetLanguageCode))) { |
| 124 | + window.alert(wbLocal.unSupportedLanguage); |
| 125 | + return; |
| 126 | + } |
127 | 127 | |
128 | | - wbGlobalSettings.setTargetLanguageValues(); |
| 128 | + wbGlobalSettings.setTargetLanguageValues(); |
129 | 129 | |
130 | | - //set source title, if target language code is english |
131 | | - if (currentLanguageCode == wbGlobalSettings.sourceLanguageCode) { |
132 | | - wbGlobalSettings.sourceLanguageArticleTitle = decodeURIComponent($.trim(wbWikiSite.getCurrentArticleTitle())); |
133 | | - } |
134 | | - //set target title, if target language code is other than english |
135 | | - else { |
136 | | - wbGlobalSettings.targetLanguageArticleTitle = decodeURIComponent($.trim(wbWikiSite.getCurrentArticleTitle())); |
137 | | - } |
| 130 | + //set source title, if target language code is english |
| 131 | + if (currentLanguageCode == wbGlobalSettings.sourceLanguageCode) { |
| 132 | + wbGlobalSettings.sourceLanguageArticleTitle = decodeURIComponent($.trim(wbWikiSite.getCurrentArticleTitle())); |
| 133 | + } |
| 134 | + //set target title, if target language code is other than english |
| 135 | + else { |
| 136 | + wbGlobalSettings.targetLanguageArticleTitle = decodeURIComponent($.trim(wbWikiSite.getCurrentArticleTitle())); |
| 137 | + } |
138 | 138 | |
139 | | - //if source title is empty, try to get new article title from browser Url (New article) |
140 | | - if (wbGlobalSettings.sourceLanguageArticleTitle.length == 0) { |
141 | | - var newArticleKey = "wbTitle", |
142 | | - //new article title from query string |
143 | | - sTitle = wbUtil.getQueryStringValue(newArticleKey); |
144 | | - if (sTitle && sTitle.length && sTitle.length > 0) { |
145 | | - wbGlobalSettings.sourceLanguageArticleTitle = decodeURIComponent($.trim(sTitle)); |
146 | | - wbGlobalSettings.isNewArticle = true; |
147 | | - } |
148 | | - } |
| 139 | + //if source title is empty, try to get new article title from browser Url (New article) |
| 140 | + if (wbGlobalSettings.sourceLanguageArticleTitle.length == 0) { |
| 141 | + var newArticleKey = "wbTitle", |
| 142 | + //new article title from query string |
| 143 | + sTitle = wbUtil.getQueryStringValue(newArticleKey); |
| 144 | + if (sTitle && sTitle.length && sTitle.length > 0) { |
| 145 | + wbGlobalSettings.sourceLanguageArticleTitle = decodeURIComponent($.trim(sTitle)); |
| 146 | + wbGlobalSettings.isNewArticle = true; |
| 147 | + } |
| 148 | + } |
149 | 149 | |
150 | | - //load application window with source and target articles |
151 | | - try { |
152 | | - wbSplash.show(); |
153 | | - wbMainWindow.show(); |
154 | | - } |
155 | | - catch (e) { |
156 | | - wbSplash.close(); |
157 | | - window.alert(wbLocal.failureMsg + "\n" + e); |
158 | | - } |
| 150 | + //load application window with source and target articles |
| 151 | + try { |
| 152 | + wbSplash.show(); |
| 153 | + wbMainWindow.show(); |
| 154 | + } |
| 155 | + catch (e) { |
| 156 | + wbSplash.close(); |
| 157 | + window.alert(wbLocal.failureMsg + "\n" + e); |
| 158 | + } |
159 | 159 | }; |
160 | 160 | |
161 | 161 | //describes the splash window for the application, to notify the user that the |
162 | 162 | //application is in the process of loading. |
163 | 163 | wikiBhasha.splashWindow = { |
164 | | - //splash window div Id. |
165 | | - windowId: "wbSplashWindow", |
166 | | - //creates and displays splash window on application UI |
167 | | - show: function() { |
168 | | - wbUIHelper.blockUI(); |
169 | | - wbUIHelper.createWindow(this.windowId, wbGlobalSettings.splashWindowHTML); |
170 | | - }, |
| 164 | + //splash window div Id. |
| 165 | + windowId: "wbSplashWindow", |
| 166 | + //creates and displays splash window on application UI |
| 167 | + show: function() { |
| 168 | + wbUIHelper.blockUI(); |
| 169 | + wbUIHelper.createWindow(this.windowId, wbGlobalSettings.splashWindowHTML); |
| 170 | + }, |
171 | 171 | |
172 | | - //hides and removes splash window from application UI |
173 | | - close: function() { |
174 | | - wbUIHelper.unblockUI(); |
175 | | - $("#" + this.windowId).remove(); |
176 | | - } |
| 172 | + //hides and removes splash window from application UI |
| 173 | + close: function() { |
| 174 | + wbUIHelper.unblockUI(); |
| 175 | + $("#" + this.windowId).remove(); |
| 176 | + } |
177 | 177 | }; |
178 | 178 | |
179 | 179 | //shortcut to call wikiBhasha.splashWindow window |
— | — | @@ -181,188 +181,188 @@ |
182 | 182 | //downloads styles and JavaScript files for application |
183 | 183 | wikiBhasha.loadApplicationRequiredFiles = function() { |
184 | 184 | |
185 | | - //if jQuery object is loaded and '$' symbol is not defined then assign jQuery object to '$' symbol |
186 | | - //in wikiPedia article '$' is set to 'undefined' by some tracking code, so we need to reassign |
187 | | - //jQuery object to '$' for normal use. |
188 | | - if (typeof $ == 'undefined' && typeof jQuery != 'undefined') { |
189 | | - $ = jQuery; |
190 | | - } |
| 185 | + //if jQuery object is loaded and '$' symbol is not defined then assign jQuery object to '$' symbol |
| 186 | + //in wikiPedia article '$' is set to 'undefined' by some tracking code, so we need to reassign |
| 187 | + //jQuery object to '$' for normal use. |
| 188 | + if (typeof $ == 'undefined' && typeof jQuery != 'undefined') { |
| 189 | + $ = jQuery; |
| 190 | + } |
191 | 191 | |
192 | | - function attachStyle(url, id /*[Optional]*/) { |
193 | | - if (url && url.length > 0) { |
194 | | - var head = document.getElementsByTagName("head")[0]; |
195 | | - var link = document.createElement("link"); |
196 | | - if (id) { |
197 | | - link.id = id; |
198 | | - } |
199 | | - link.type = "text/css"; |
200 | | - link.rel = "stylesheet"; |
201 | | - link.media = "screen"; |
202 | | - link.href = url; |
203 | | - head.appendChild(link); |
204 | | - } |
205 | | - }; |
| 192 | + function attachStyle(url, id /*[Optional]*/) { |
| 193 | + if (url && url.length > 0) { |
| 194 | + var head = document.getElementsByTagName("head")[0]; |
| 195 | + var link = document.createElement("link"); |
| 196 | + if (id) { |
| 197 | + link.id = id; |
| 198 | + } |
| 199 | + link.type = "text/css"; |
| 200 | + link.rel = "stylesheet"; |
| 201 | + link.media = "screen"; |
| 202 | + link.href = url; |
| 203 | + head.appendChild(link); |
| 204 | + } |
| 205 | + }; |
206 | 206 | |
207 | | - if (typeof baseUrl != "undefined") { |
208 | | - //wikiBhasha application css files |
209 | | - var reqCSS = ["styles/jquery-ui-1.7.2.css", |
210 | | - "styles/hybridModeStyles.css", |
211 | | - "styles/wikiBhasha.css"], |
| 207 | + if (typeof baseUrl != "undefined") { |
| 208 | + //wikiBhasha application css files |
| 209 | + var reqCSS = ["styles/jquery-ui-1.7.2.css", |
| 210 | + "styles/hybridModeStyles.css", |
| 211 | + "styles/wikiBhasha.css"], |
212 | 212 | |
213 | | - //files required for loading language selection window |
214 | | - reqJSForLanguageSelection = ["js/jsLib/jquery-ui-1.7.2.min.js", |
215 | | - "js/extern/wikipediaInterface.js", |
216 | | - "js/extern/languageServicesInterface.js", |
217 | | - "js/extern/loggerInterface.js", |
218 | | - "js/core/configurations.js", |
219 | | - "js/core/configurations.templateMappers.js", |
220 | | - "js/core/globalSettings.js", |
221 | | - "js/core/languageSelectionWindow.js", |
222 | | - "js/core/utils.js"], |
| 213 | + //files required for loading language selection window |
| 214 | + reqJSForLanguageSelection = ["js/jsLib/jquery-ui-1.7.2.min.js", |
| 215 | + "js/extern/wikipediaInterface.js", |
| 216 | + "js/extern/languageServicesInterface.js", |
| 217 | + "js/extern/loggerInterface.js", |
| 218 | + "js/core/configurations.js", |
| 219 | + "js/core/configurations.templateMappers.js", |
| 220 | + "js/core/globalSettings.js", |
| 221 | + "js/core/languageSelectionWindow.js", |
| 222 | + "js/core/utils.js"], |
223 | 223 | |
224 | | - //files required for loading complete application |
225 | | - reqJSForCoreApplication = ["js/jsLib/jquery-ui-1.7.2.min.js", |
226 | | - "js/jsLib/jquery.contextmenu.js", |
227 | | - "js/jsLib/jquery.shortcut.js", |
228 | | - "js/extern/wikipediaInterface.js", |
229 | | - "js/extern/languageServicesInterface.js", |
230 | | - "js/extern/transliterationServicesInterface.js", |
231 | | - "js/extern/loggerInterface.js", |
232 | | - "js/core/configurations.js", |
233 | | - "js/core/configurations.templateMappers.js", |
234 | | - "js/core/globalSettings.js", |
235 | | - "js/core/historyManagement.js", |
236 | | - "js/core/mainWindow.js", |
237 | | - "js/core/paneManagement.js", |
238 | | - "js/core/scratchpadWindow.js", |
239 | | - "js/core/feedbackWindow.js", |
240 | | - "js/core/searchWindow.js", |
241 | | - "js/core/wikiMarkupEditWindow.js", |
242 | | - "js/core/templateAndLinkTranslator.js", |
243 | | - "js/core/themes.js", |
244 | | - "js/core/utils.js", |
245 | | - "js/core/wikiModeConverters.js", |
246 | | - "js/core/chineseLangSelection.js", |
247 | | - "js/core/wikiParser.js"], |
| 224 | + //files required for loading complete application |
| 225 | + reqJSForCoreApplication = ["js/jsLib/jquery-ui-1.7.2.min.js", |
| 226 | + "js/jsLib/jquery.contextmenu.js", |
| 227 | + "js/jsLib/jquery.shortcut.js", |
| 228 | + "js/extern/wikipediaInterface.js", |
| 229 | + "js/extern/languageServicesInterface.js", |
| 230 | + "js/extern/transliterationServicesInterface.js", |
| 231 | + "js/extern/loggerInterface.js", |
| 232 | + "js/core/configurations.js", |
| 233 | + "js/core/configurations.templateMappers.js", |
| 234 | + "js/core/globalSettings.js", |
| 235 | + "js/core/historyManagement.js", |
| 236 | + "js/core/mainWindow.js", |
| 237 | + "js/core/paneManagement.js", |
| 238 | + "js/core/scratchpadWindow.js", |
| 239 | + "js/core/feedbackWindow.js", |
| 240 | + "js/core/searchWindow.js", |
| 241 | + "js/core/wikiMarkupEditWindow.js", |
| 242 | + "js/core/templateAndLinkTranslator.js", |
| 243 | + "js/core/themes.js", |
| 244 | + "js/core/utils.js", |
| 245 | + "js/core/wikiModeConverters.js", |
| 246 | + "js/core/chineseLangSelection.js", |
| 247 | + "js/core/wikiParser.js"], |
248 | 248 | |
249 | | - //wikiBhasha default theme |
250 | | - themeCss = ["styles/themes/wikiBhasha.blue.css"]; |
| 249 | + //wikiBhasha default theme |
| 250 | + themeCss = ["styles/themes/wikiBhasha.blue.css"]; |
251 | 251 | |
252 | | - //load css files |
253 | | - for (var i = 0; i < reqCSS.length; i++) { |
254 | | - //create url |
255 | | - var url = baseUrl + reqCSS[i]; |
256 | | - //attach other style expect themes |
257 | | - attachStyle(url); |
258 | | - } |
| 252 | + //load css files |
| 253 | + for (var i = 0; i < reqCSS.length; i++) { |
| 254 | + //create url |
| 255 | + var url = baseUrl + reqCSS[i]; |
| 256 | + //attach other style expect themes |
| 257 | + attachStyle(url); |
| 258 | + } |
259 | 259 | |
260 | | - //load themes css files |
261 | | - for (var i = 0; i < themeCss.length; i++) { |
262 | | - //create url |
263 | | - var url = baseUrl + themeCss[i], |
264 | | - id = "wbCSSBlue"; |
265 | | - attachStyle(url, id); |
266 | | - } |
| 260 | + //load themes css files |
| 261 | + for (var i = 0; i < themeCss.length; i++) { |
| 262 | + //create url |
| 263 | + var url = baseUrl + themeCss[i], |
| 264 | + id = "wbCSSBlue"; |
| 265 | + attachStyle(url, id); |
| 266 | + } |
267 | 267 | |
268 | | - //load javascript files |
269 | | - var fileCount = 0, |
270 | | - //check whether source language is 'english' or not. if so then load the language selection window else complete application files |
271 | | - reqJS = (wikiSourceLanguage == "en") ? reqJSForLanguageSelection : reqJSForCoreApplication; |
272 | | - for (var i = 0; i < reqJS.length; i++) { |
273 | | - var url = baseUrl + reqJS[i]; |
274 | | - $.getScript(url, function() { |
275 | | - fileCount = fileCount + 1; |
276 | | - //check if all the files are loaded |
277 | | - if (fileCount == reqJS.length) { |
278 | | - //download strings after downloading all application files |
279 | | - wikiBhasha.loadLocalizedStrings(); |
280 | | - } |
281 | | - }); |
282 | | - } |
283 | | - } |
| 268 | + //load javascript files |
| 269 | + var fileCount = 0, |
| 270 | + //check whether source language is 'english' or not. if so then load the language selection window else complete application files |
| 271 | + reqJS = (wikiSourceLanguage == "en") ? reqJSForLanguageSelection : reqJSForCoreApplication; |
| 272 | + for (var i = 0; i < reqJS.length; i++) { |
| 273 | + var url = baseUrl + reqJS[i]; |
| 274 | + $.getScript(url, function() { |
| 275 | + fileCount = fileCount + 1; |
| 276 | + //check if all the files are loaded |
| 277 | + if (fileCount == reqJS.length) { |
| 278 | + //download strings after downloading all application files |
| 279 | + wikiBhasha.loadLocalizedStrings(); |
| 280 | + } |
| 281 | + }); |
| 282 | + } |
| 283 | + } |
284 | 284 | }; |
285 | 285 | |
286 | 286 | //loads localized strings(javascript file) as per user settings |
287 | 287 | wikiBhasha.loadLocalizedStrings = function() { |
288 | | - // set global values |
289 | | - wbGlobalSettings.baseUrl = baseUrl; |
290 | | - wbGlobalSettings.targetLanguageCode = targetLanguageCode; |
291 | | - wbGlobalSettings.userLanguageCode = wbGlobalSettings.getUserLanguage(); |
| 288 | + // set global values |
| 289 | + wbGlobalSettings.baseUrl = baseUrl; |
| 290 | + wbGlobalSettings.targetLanguageCode = targetLanguageCode; |
| 291 | + wbGlobalSettings.userLanguageCode = wbGlobalSettings.getUserLanguage(); |
292 | 292 | |
293 | | - //create localized string file URL |
294 | | - var url = wbGlobalSettings.baseUrl + wbGlobalSettings.languageFolder + wbGlobalSettings.userLanguageCode + "/strings.js"; |
295 | | - $.getScript(url, function() { |
296 | | - try { |
297 | | - // Initialize configurations and create session first. |
298 | | - wikiBhasha.configurations.initialize(); |
299 | | - wbUIHelper.createSession(); |
| 293 | + //create localized string file URL |
| 294 | + var url = wbGlobalSettings.baseUrl + wbGlobalSettings.languageFolder + wbGlobalSettings.userLanguageCode + "/strings.js"; |
| 295 | + $.getScript(url, function() { |
| 296 | + try { |
| 297 | + // Initialize configurations and create session first. |
| 298 | + wikiBhasha.configurations.initialize(); |
| 299 | + wbUIHelper.createSession(); |
300 | 300 | |
301 | | - var curLangCode = wbWikiSite.getCurrentLanguage(); |
302 | | - if (curLangCode != wbGlobalSettings.sourceLanguageCode) { |
303 | | - // Check if the article is protected. If so, don’t allow the user to edit it. Just show the message and close WikiBhasha. Otherwise proceed further to load the page in WikiBhasha. |
304 | | - wbWikiSite.isArticleProtected(curLangCode, $.trim(wbWikiSite.getCurrentArticleTitle()), function(isArticleProtected) { |
305 | | - if (isArticleProtected) { |
306 | | - window.alert(wbLocal.nonEditableMessage); |
307 | | - //remove 'loading...' div after successful call of wikiBhasha. |
308 | | - $("#wbLoadDiv").remove(); |
309 | | - } else { |
310 | | - if (curLangCode === 'zh') { |
311 | | - var urlGetMltCode = wbUtil.getQueryStringValue('mltCode'); |
312 | | - if (!urlGetMltCode) { |
313 | | - $("#wbLoadDiv").remove(); |
314 | | - wbChineseLangSelection.show(); |
315 | | - return; |
316 | | - } |
317 | | - } |
318 | | - wikiBhasha.loadApplication(); |
319 | | - } |
320 | | - return; |
321 | | - }); |
322 | | - } else { |
323 | | - wikiBhasha.loadApplication(); |
324 | | - } |
325 | | - return; |
326 | | - } |
327 | | - catch (e) { |
328 | | - window.alert(wbLocal.failureMsg + "\n" + e); |
329 | | - return; |
330 | | - } |
331 | | - }); |
| 301 | + var curLangCode = wbWikiSite.getCurrentLanguage(); |
| 302 | + if (curLangCode != wbGlobalSettings.sourceLanguageCode) { |
| 303 | + // Check if the article is protected. If so, don’t allow the user to edit it. Just show the message and close WikiBhasha. Otherwise proceed further to load the page in WikiBhasha. |
| 304 | + wbWikiSite.isArticleProtected(curLangCode, $.trim(wbWikiSite.getCurrentArticleTitle()), function(isArticleProtected) { |
| 305 | + if (isArticleProtected) { |
| 306 | + window.alert(wbLocal.nonEditableMessage); |
| 307 | + //remove 'loading...' div after successful call of wikiBhasha. |
| 308 | + $("#wbLoadDiv").remove(); |
| 309 | + } else { |
| 310 | + if (curLangCode === 'zh') { |
| 311 | + var urlGetMltCode = wbUtil.getQueryStringValue('mltCode'); |
| 312 | + if (!urlGetMltCode) { |
| 313 | + $("#wbLoadDiv").remove(); |
| 314 | + wbChineseLangSelection.show(); |
| 315 | + return; |
| 316 | + } |
| 317 | + } |
| 318 | + wikiBhasha.loadApplication(); |
| 319 | + } |
| 320 | + return; |
| 321 | + }); |
| 322 | + } else { |
| 323 | + wikiBhasha.loadApplication(); |
| 324 | + } |
| 325 | + return; |
| 326 | + } |
| 327 | + catch (e) { |
| 328 | + window.alert(wbLocal.failureMsg + "\n" + e); |
| 329 | + return; |
| 330 | + } |
| 331 | + }); |
332 | 332 | }; |
333 | 333 | |
334 | 334 | // load jquery library if it is not downloaded yet |
335 | 335 | // We require separate function for loading jQuery because this should not use any jQuery methods by itself. |
336 | 336 | // NOTE: Never use any jQuery functions within this function. |
337 | 337 | wikiBhasha.loadJQuery = function(callback) { |
338 | | - if (typeof baseUrl != "undefined") { |
339 | | - var script = document.createElement("script"); |
340 | | - script.type = "text/javascript"; |
341 | | - //check whether file is loaded or not if so, call the the 'callback' function |
342 | | - //IE fix, in IE 'readyState' event is fired once the file is loaded |
343 | | - if (script.readyState) { |
344 | | - script.onreadystatechange = function() { |
345 | | - if (script.readyState == "loaded" || |
346 | | - script.readyState == "complete") { |
347 | | - script.onreadystatechange = null; |
348 | | - callback(); |
349 | | - } |
350 | | - }; |
351 | | - } |
352 | | - //other browsers, 'onload' event will be fired |
353 | | - else { |
354 | | - script.onload = function() { |
355 | | - callback(); |
356 | | - }; |
357 | | - } |
358 | | - script.src = baseUrl + "js/jsLib/jquery-1.3.2.min.js"; |
359 | | - document.body.appendChild(script); |
360 | | - } |
| 338 | + if (typeof baseUrl != "undefined") { |
| 339 | + var script = document.createElement("script"); |
| 340 | + script.type = "text/javascript"; |
| 341 | + //check whether file is loaded or not if so, call the the 'callback' function |
| 342 | + //IE fix, in IE 'readyState' event is fired once the file is loaded |
| 343 | + if (script.readyState) { |
| 344 | + script.onreadystatechange = function() { |
| 345 | + if (script.readyState == "loaded" || |
| 346 | + script.readyState == "complete") { |
| 347 | + script.onreadystatechange = null; |
| 348 | + callback(); |
| 349 | + } |
| 350 | + }; |
| 351 | + } |
| 352 | + //other browsers, 'onload' event will be fired |
| 353 | + else { |
| 354 | + script.onload = function() { |
| 355 | + callback(); |
| 356 | + }; |
| 357 | + } |
| 358 | + script.src = baseUrl + "js/jsLib/jquery-1.3.2.min.js"; |
| 359 | + document.body.appendChild(script); |
| 360 | + } |
361 | 361 | }; |
362 | 362 | |
363 | 363 | //load jquery library if it is not loaded |
364 | 364 | if (typeof jQuery === "undefined") { |
365 | | - //after loading jQuery load other required files only after some time gap(ex:100ms), assuming that jQuery will take some time to load into browser. |
366 | | - wikiBhasha.loadJQuery(function() { window.setTimeout("wikiBhasha.loadApplicationRequiredFiles()", 100); }); |
| 365 | + //after loading jQuery load other required files only after some time gap(ex:100ms), assuming that jQuery will take some time to load into browser. |
| 366 | + wikiBhasha.loadJQuery(function() { window.setTimeout("wikiBhasha.loadApplicationRequiredFiles()", 100); }); |
367 | 367 | } else { |
368 | | - wikiBhasha.loadApplicationRequiredFiles(); |
| 368 | + wikiBhasha.loadApplicationRequiredFiles(); |
369 | 369 | } |
\ No newline at end of file |
Index: trunk/extensions/WikiBhasha/src/js/extern/wikipediaInterface.js |
— | — | @@ -21,299 +21,299 @@ |
22 | 22 | |
23 | 23 | //make sure the namespace exists. |
24 | 24 | if (typeof (wikiBhasha.extern) === "undefined") { |
25 | | - wikiBhasha.extern = {}; |
| 25 | + wikiBhasha.extern = {}; |
26 | 26 | } |
27 | 27 | |
28 | 28 | (function() { |
29 | | - //includes all the properties and methods to interact with external interfaces |
30 | | - //(Ex: interacting with wikipedia APIs). |
31 | | - wikiBhasha.extern.wikipediaInterface = { |
| 29 | + //includes all the properties and methods to interact with external interfaces |
| 30 | + //(Ex: interacting with wikipedia APIs). |
| 31 | + wikiBhasha.extern.wikipediaInterface = { |
32 | 32 | |
33 | | - //regular expression to check wikipedia page url |
34 | | - wikiPageUrlRegex: /^(http):\/\/[A-Za-z]+\.(wikipedia.org)/, |
| 33 | + //regular expression to check wikipedia page url |
| 34 | + wikiPageUrlRegex: /^(http):\/\/[A-Za-z]+\.(wikipedia.org)/, |
35 | 35 | |
36 | | - //API to get wikipedia article |
37 | | - wikiArticleMarkupAPI: "http://{0}.wikipedia.org/w/api.php?&action=query&titles={1}&rvprop=content&prop=revisions&redirects=1&format=json", |
| 36 | + //API to get wikipedia article |
| 37 | + wikiArticleMarkupAPI: "http://{0}.wikipedia.org/w/api.php?&action=query&titles={1}&rvprop=content&prop=revisions&redirects=1&format=json", |
38 | 38 | |
39 | | - //API to search wikipedia article |
40 | | - wikiSearchAPI: "http://{0}.wikipedia.org/w/api.php?action=query&list=search&srsearch={1}&format=json", |
| 39 | + //API to search wikipedia article |
| 40 | + wikiSearchAPI: "http://{0}.wikipedia.org/w/api.php?action=query&list=search&srsearch={1}&format=json", |
41 | 41 | |
42 | | - //API to search wikipedia article |
43 | | - wikiPreviewAPI: "http://{0}.wikipedia.org/w/api.php?action=parse&text={1}&format=json", |
| 42 | + //API to search wikipedia article |
| 43 | + wikiPreviewAPI: "http://{0}.wikipedia.org/w/api.php?action=parse&text={1}&format=json", |
44 | 44 | |
45 | | - //API to get wikipedia language links |
46 | | - wikiLangLinksAPI: "http://{0}.wikipedia.org/w/api.php?action=query&prop=langlinks&format=json&redirects=1&titles={1}&lllimit=5000", |
| 45 | + //API to get wikipedia language links |
| 46 | + wikiLangLinksAPI: "http://{0}.wikipedia.org/w/api.php?action=query&prop=langlinks&format=json&redirects=1&titles={1}&lllimit=5000", |
47 | 47 | |
48 | | - //API to get wikipedia article page Id |
49 | | - wikiArticlePageIdAPI: "http://{0}.wikipedia.org/w/api.php?action=query&titles={1}&indexpageids&redirects=1&format=json", |
| 48 | + //API to get wikipedia article page Id |
| 49 | + wikiArticlePageIdAPI: "http://{0}.wikipedia.org/w/api.php?action=query&titles={1}&indexpageids&redirects=1&format=json", |
50 | 50 | |
51 | | - //wikipedia URL to get the article in Edit mode |
52 | | - wikiEditUrl: "http://{0}.wikipedia.org/w/index.php?title={1}&action=edit", |
| 51 | + //wikipedia URL to get the article in Edit mode |
| 52 | + wikiEditUrl: "http://{0}.wikipedia.org/w/index.php?title={1}&action=edit", |
53 | 53 | |
54 | | - // wikipedia URL to get the protection information for a given article |
55 | | - wikiArticleProtectionInfoAPI: "http://{0}.wikipedia.org/w/api.php?action=query&prop=info&inprop=protection&titles={1}&format=json", |
| 54 | + // wikipedia URL to get the protection information for a given article |
| 55 | + wikiArticleProtectionInfoAPI: "http://{0}.wikipedia.org/w/api.php?action=query&prop=info&inprop=protection&titles={1}&format=json", |
56 | 56 | |
57 | | - //API to get interwiki links for given titles |
58 | | - wikiGetInterWikiLinksAPI: "http://{0}.wikipedia.org/w/api.php?action=query&titles={1}&prop=langlinks&lllimit=500&format=json", |
59 | | - |
60 | | - wikiMaxTitlesPerInterWikiLinksApi: 50, |
61 | | - |
62 | | - //wikipedia base URL |
63 | | - wikiUrlFormat: "http://{0}.wikipedia.org/wiki/{1}", |
| 57 | + //API to get interwiki links for given titles |
| 58 | + wikiGetInterWikiLinksAPI: "http://{0}.wikipedia.org/w/api.php?action=query&titles={1}&prop=langlinks&lllimit=500&format=json", |
64 | 59 | |
65 | | - //wikipedia Editable 'textarea' Id/name |
66 | | - wikiComposeTextArea: "wpTextbox1", |
| 60 | + wikiMaxTitlesPerInterWikiLinksApi: 50, |
67 | 61 | |
68 | | - //list of elements to be removed for publish step to give more real-estate to edit text area |
69 | | - wikiEditPageNonCriticalDivs: "#mw-panel, #p-Contribuer, #p-help,#p-cactions,#centralNotice,#p-navigation,#p-logo,#firstHeading,#siteSub,#p-search,#p-interaction,#p-tb,#p-lang,#coordinates", |
| 62 | + //wikipedia base URL |
| 63 | + wikiUrlFormat: "http://{0}.wikipedia.org/wiki/{1}", |
70 | 64 | |
71 | | - //wikipedia compose area element id |
72 | | - wikiComposeDiv: "#content", |
| 65 | + //wikipedia Editable 'textarea' Id/name |
| 66 | + wikiComposeTextArea: "wpTextbox1", |
73 | 67 | |
74 | | - //wikipedia compose links |
75 | | - wikiComposeLinks: "#globalWrapper a", |
| 68 | + //list of elements to be removed for publish step to give more real-estate to edit text area |
| 69 | + wikiEditPageNonCriticalDivs: "#mw-panel, #p-Contribuer, #p-help,#p-cactions,#centralNotice,#p-navigation,#p-logo,#firstHeading,#siteSub,#p-search,#p-interaction,#p-tb,#p-lang,#coordinates", |
76 | 70 | |
77 | | - //wikipedia save button id |
78 | | - wikiSaveButton: "wpSave", |
| 71 | + //wikipedia compose area element id |
| 72 | + wikiComposeDiv: "#content", |
79 | 73 | |
80 | | - //gets the corresponding source language article title for a given target language article |
81 | | - getSourceTitle: function(targetLanguageCode, sourceLanguageCode, targetLanguageArticleTitle, callback) { |
82 | | - this.getTargetLanguageTitle(targetLanguageCode, sourceLanguageCode, targetLanguageArticleTitle, function(data) { |
83 | | - var sourceLanguageArticleTitle = (data && data.length) ? $.trim(data) : null; |
84 | | - callback(sourceLanguageArticleTitle); |
85 | | - }); |
86 | | - }, |
| 74 | + //wikipedia compose links |
| 75 | + wikiComposeLinks: "#globalWrapper a", |
87 | 76 | |
88 | | - //searches wikipedia articles for the given search key |
89 | | - search: function(lang, $searchKey, callback) { |
90 | | - if (lang && lang.length && $searchKey && $searchKey.length) { |
91 | | - var results = [], |
92 | | - urlData = wbUtil.stringFormat(this.wikiSearchAPI, lang, encodeURIComponent($searchKey)), |
93 | | - kbSize = 1024, |
94 | | - searchResult = "", |
95 | | - targetUrl = ""; |
| 77 | + //wikipedia save button id |
| 78 | + wikiSaveButton: "wpSave", |
96 | 79 | |
97 | | - $.getJSON(urlData, 'callback=?', function(data) { |
98 | | - if (data && data.query && data.query.search) { |
99 | | - for (i = 0; i < data.query.search.length; i++) { |
100 | | - searchResult = data.query.search[i]; |
101 | | - //opera fix: |
102 | | - //Pages displayed inside an iframe will inherit the character encoding of the parent page, unless they specify their own character encoding. |
103 | | - //A malicious page that uses the UTF-7 character encoding can include other sites for example inside iframes. This can be exploited to perform cross-site scripting on certain sites, allowing the attacker to get access to the user's session data for those sites. |
104 | | - //http://www.opera.com/support/kb/view/855/ |
105 | | - if ($.browser.opera) { |
106 | | - targetUrl = wbUtil.stringFormat(wbWikiSite.wikiUrlFormat, lang, searchResult.title); |
107 | | - } |
108 | | - //Other browsers, open with edit url |
109 | | - else { |
110 | | - targetUrl = wbUtil.stringFormat(wbWikiSite.wikiEditUrl, lang, searchResult.title); |
111 | | - } |
112 | | - results[i] = { wikiUrlFormat: targetUrl, |
113 | | - title: searchResult.title, |
114 | | - snippet: searchResult.snippet, |
115 | | - size: Math.round((searchResult.size / kbSize), 2), |
116 | | - wordcount: searchResult.wordcount, |
117 | | - timestamp: searchResult.timestamp |
118 | | - }; |
119 | | - } |
120 | | - } |
121 | | - callback(results); |
122 | | - }); |
123 | | - } |
124 | | - }, |
| 80 | + //gets the corresponding source language article title for a given target language article |
| 81 | + getSourceTitle: function(targetLanguageCode, sourceLanguageCode, targetLanguageArticleTitle, callback) { |
| 82 | + this.getTargetLanguageTitle(targetLanguageCode, sourceLanguageCode, targetLanguageArticleTitle, function(data) { |
| 83 | + var sourceLanguageArticleTitle = (data && data.length) ? $.trim(data) : null; |
| 84 | + callback(sourceLanguageArticleTitle); |
| 85 | + }); |
| 86 | + }, |
125 | 87 | |
126 | | - //gets the title of target language article for given source language article title |
127 | | - getTargetLanguageTitle: function(sourceLanguage, targetLanguage, sourceLanguageArticleTitle, callback) { |
128 | | - if (sourceLanguage && sourceLanguage.length && targetLanguage && |
129 | | - targetLanguage.length && sourceLanguageArticleTitle && sourceLanguageArticleTitle.length) { |
130 | | - var result = "", |
131 | | - urlData = wbUtil.stringFormat(this.wikiLangLinksAPI, sourceLanguage, encodeURIComponent(sourceLanguageArticleTitle.replace("%20", " "))); |
| 88 | + //searches wikipedia articles for the given search key |
| 89 | + search: function(lang, $searchKey, callback) { |
| 90 | + if (lang && lang.length && $searchKey && $searchKey.length) { |
| 91 | + var results = [], |
| 92 | + urlData = wbUtil.stringFormat(this.wikiSearchAPI, lang, encodeURIComponent($searchKey)), |
| 93 | + kbSize = 1024, |
| 94 | + searchResult = "", |
| 95 | + targetUrl = ""; |
132 | 96 | |
133 | | - this.getArticlePageId(sourceLanguage, sourceLanguageArticleTitle, function(pageID) { |
134 | | - if (pageID) { |
135 | | - $.getJSON(urlData, 'callback=?', function(data) { |
136 | | - var langLinkList = data.query.pages[pageID].langlinks; |
137 | | - if (langLinkList) { |
138 | | - for (i = 0; i < langLinkList.length; i++) { |
139 | | - if (targetLanguage === langLinkList[i].lang) { |
140 | | - result = langLinkList[i]["*"]; |
141 | | - break; |
142 | | - } |
143 | | - } |
144 | | - callback(result); |
145 | | - } |
146 | | - else { |
147 | | - callback(null); |
148 | | - } |
149 | | - }); |
150 | | - } |
151 | | - else { |
152 | | - callback(null); |
153 | | - } |
154 | | - }); |
155 | | - } |
156 | | - }, |
| 97 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 98 | + if (data && data.query && data.query.search) { |
| 99 | + for (i = 0; i < data.query.search.length; i++) { |
| 100 | + searchResult = data.query.search[i]; |
| 101 | + //opera fix: |
| 102 | + //Pages displayed inside an iframe will inherit the character encoding of the parent page, unless they specify their own character encoding. |
| 103 | + //A malicious page that uses the UTF-7 character encoding can include other sites for example inside iframes. This can be exploited to perform cross-site scripting on certain sites, allowing the attacker to get access to the user's session data for those sites. |
| 104 | + //http://www.opera.com/support/kb/view/855/ |
| 105 | + if ($.browser.opera) { |
| 106 | + targetUrl = wbUtil.stringFormat(wbWikiSite.wikiUrlFormat, lang, searchResult.title); |
| 107 | + } |
| 108 | + //Other browsers, open with edit url |
| 109 | + else { |
| 110 | + targetUrl = wbUtil.stringFormat(wbWikiSite.wikiEditUrl, lang, searchResult.title); |
| 111 | + } |
| 112 | + results[i] = { wikiUrlFormat: targetUrl, |
| 113 | + title: searchResult.title, |
| 114 | + snippet: searchResult.snippet, |
| 115 | + size: Math.round((searchResult.size / kbSize), 2), |
| 116 | + wordcount: searchResult.wordcount, |
| 117 | + timestamp: searchResult.timestamp |
| 118 | + }; |
| 119 | + } |
| 120 | + } |
| 121 | + callback(results); |
| 122 | + }); |
| 123 | + } |
| 124 | + }, |
157 | 125 | |
158 | | - //gets source article content in wiki format for a given article title |
159 | | - getArticleInWikiFormat: function(lang, title, callback) { |
160 | | - if (lang && lang.length && title && title.length) { |
161 | | - var markupArticle = ""; |
162 | | - this.getArticlePageId(lang, title, function(data) { |
163 | | - if (data) { |
164 | | - var pageId = data; |
165 | | - var urlData = wbUtil.stringFormat(wbWikiSite.wikiArticleMarkupAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
166 | | - $.getJSON(urlData, 'callback=?', function(data) { |
167 | | - if (data && data.query && data.query.pages && data.query.pages[pageId].revisions) { |
168 | | - markupArticle = data.query.pages[pageId].revisions[0]["*"]; |
169 | | - callback(markupArticle); |
170 | | - } |
171 | | - else { |
172 | | - callback(null); |
173 | | - } |
174 | | - }); |
175 | | - } |
176 | | - else { |
177 | | - callback(null); |
178 | | - } |
179 | | - }); |
180 | | - } |
181 | | - }, |
| 126 | + //gets the title of target language article for given source language article title |
| 127 | + getTargetLanguageTitle: function(sourceLanguage, targetLanguage, sourceLanguageArticleTitle, callback) { |
| 128 | + if (sourceLanguage && sourceLanguage.length && targetLanguage && |
| 129 | + targetLanguage.length && sourceLanguageArticleTitle && sourceLanguageArticleTitle.length) { |
| 130 | + var result = "", |
| 131 | + urlData = wbUtil.stringFormat(this.wikiLangLinksAPI, sourceLanguage, encodeURIComponent(sourceLanguageArticleTitle.replace("%20", " "))); |
182 | 132 | |
183 | | - //checks the protection information for the given article title in the given langauge. Returns ‘true’ |
184 | | - //for the callback function, if the given article is protected. Otherwise returns ‘false’ for the callback function. |
185 | | - isArticleProtected: function(lang, title, callback) { |
186 | | - if (lang && lang.length && title && title.length) { |
187 | | - var urlData = wbUtil.stringFormat(wbWikiSite.wikiArticleProtectionInfoAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
188 | | - $.getJSON(urlData, 'callback=?', function(data) { |
189 | | - if (data && data.query && data.query.pages) { |
190 | | - var pages = data.query.pages; |
191 | | - for (var page in pages) { |
192 | | - if (typeof pages[page].protection !== "undefined" && pages[page].protection.length > 0) { |
193 | | - callback(true); |
194 | | - return; |
195 | | - } |
196 | | - else { |
197 | | - callback(false); |
198 | | - return; |
199 | | - } |
200 | | - } |
| 133 | + this.getArticlePageId(sourceLanguage, sourceLanguageArticleTitle, function(pageID) { |
| 134 | + if (pageID) { |
| 135 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 136 | + var langLinkList = data.query.pages[pageID].langlinks; |
| 137 | + if (langLinkList) { |
| 138 | + for (i = 0; i < langLinkList.length; i++) { |
| 139 | + if (targetLanguage === langLinkList[i].lang) { |
| 140 | + result = langLinkList[i]["*"]; |
| 141 | + break; |
| 142 | + } |
| 143 | + } |
| 144 | + callback(result); |
| 145 | + } |
| 146 | + else { |
| 147 | + callback(null); |
| 148 | + } |
| 149 | + }); |
| 150 | + } |
| 151 | + else { |
| 152 | + callback(null); |
| 153 | + } |
| 154 | + }); |
| 155 | + } |
| 156 | + }, |
201 | 157 | |
202 | | - } |
203 | | - else { |
204 | | - callback(false); |
205 | | - return; |
206 | | - } |
207 | | - }); |
208 | | - } |
209 | | - }, |
| 158 | + //gets source article content in wiki format for a given article title |
| 159 | + getArticleInWikiFormat: function(lang, title, callback) { |
| 160 | + if (lang && lang.length && title && title.length) { |
| 161 | + var markupArticle = ""; |
| 162 | + this.getArticlePageId(lang, title, function(data) { |
| 163 | + if (data) { |
| 164 | + var pageId = data; |
| 165 | + var urlData = wbUtil.stringFormat(wbWikiSite.wikiArticleMarkupAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
| 166 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 167 | + if (data && data.query && data.query.pages && data.query.pages[pageId].revisions) { |
| 168 | + markupArticle = data.query.pages[pageId].revisions[0]["*"]; |
| 169 | + callback(markupArticle); |
| 170 | + } |
| 171 | + else { |
| 172 | + callback(null); |
| 173 | + } |
| 174 | + }); |
| 175 | + } |
| 176 | + else { |
| 177 | + callback(null); |
| 178 | + } |
| 179 | + }); |
| 180 | + } |
| 181 | + }, |
210 | 182 | |
211 | | - //gets article page Id for a given article title |
212 | | - getArticlePageId: function(lang, title, callback) { |
213 | | - if (lang && lang.length && title && title.length) { |
214 | | - var pageId = "", |
215 | | - urlData = wbUtil.stringFormat(this.wikiArticlePageIdAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
216 | | - $.getJSON(urlData, 'callback=?', function(data) { |
217 | | - if (data && data.query && data.query.pageids) { |
218 | | - pageId = data.query.pageids[0]; |
219 | | - callback(pageId); |
220 | | - } |
221 | | - else { |
222 | | - callback(null); |
223 | | - } |
224 | | - }); |
225 | | - } |
226 | | - }, |
| 183 | + //checks the protection information for the given article title in the given langauge. Returns ‘true’ |
| 184 | + //for the callback function, if the given article is protected. Otherwise returns ‘false’ for the callback function. |
| 185 | + isArticleProtected: function(lang, title, callback) { |
| 186 | + if (lang && lang.length && title && title.length) { |
| 187 | + var urlData = wbUtil.stringFormat(wbWikiSite.wikiArticleProtectionInfoAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
| 188 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 189 | + if (data && data.query && data.query.pages) { |
| 190 | + var pages = data.query.pages; |
| 191 | + for (var page in pages) { |
| 192 | + if (typeof pages[page].protection !== "undefined" && pages[page].protection.length > 0) { |
| 193 | + callback(true); |
| 194 | + return; |
| 195 | + } |
| 196 | + else { |
| 197 | + callback(false); |
| 198 | + return; |
| 199 | + } |
| 200 | + } |
227 | 201 | |
228 | | - //gets inter wiki links for a given set of titles |
229 | | - getInterWikiLinks: function(titles, optionalApiTags, interWikiLinksCallback) { |
230 | | - if (titles && titles.length) { |
231 | | - var urlData = wbUtil.stringFormat(this.wikiGetInterWikiLinksAPI, "en", encodeURIComponent(titles.replace("%20", " "))); |
232 | | - if (optionalApiTags) { |
233 | | - urlData = urlData + "&" + optionalApiTags; |
234 | | - } |
235 | | - |
236 | | - $.getJSON(urlData, 'callback=?', function(data) { |
237 | | - if (data) { |
238 | | - interWikiLinksCallback(data, titles); |
239 | | - } |
240 | | - }); |
241 | | - } |
242 | | - }, |
243 | | - |
244 | | - //gets the wiki edit page URL for the given title and language code |
245 | | - getEditPageUrl: function(lang, title) { |
246 | | - //if all the parameters are not null |
247 | | - if (lang && lang.length && title && title.length) { |
248 | | - return wbUtil.stringFormat(this.wikiEditUrl, lang, encodeURIComponent(title)); |
249 | | - } |
250 | | - }, |
| 202 | + } |
| 203 | + else { |
| 204 | + callback(false); |
| 205 | + return; |
| 206 | + } |
| 207 | + }); |
| 208 | + } |
| 209 | + }, |
251 | 210 | |
252 | | - //gets the current article language code |
253 | | - getCurrentLanguage: function() { |
254 | | - return (typeof wikiSourceLanguage !== "undefined") ? wikiSourceLanguage : "en"; |
255 | | - }, |
| 211 | + //gets article page Id for a given article title |
| 212 | + getArticlePageId: function(lang, title, callback) { |
| 213 | + if (lang && lang.length && title && title.length) { |
| 214 | + var pageId = "", |
| 215 | + urlData = wbUtil.stringFormat(this.wikiArticlePageIdAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
| 216 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 217 | + if (data && data.query && data.query.pageids) { |
| 218 | + pageId = data.query.pageids[0]; |
| 219 | + callback(pageId); |
| 220 | + } |
| 221 | + else { |
| 222 | + callback(null); |
| 223 | + } |
| 224 | + }); |
| 225 | + } |
| 226 | + }, |
256 | 227 | |
257 | | - //checks for the given article availability in particular language. |
258 | | - isArticleAvailable: function(lang, title, callback) { |
259 | | - if (lang && lang.length && title && title.length) { |
260 | | - var targetArticleWikiApi = wbUtil.stringFormat(wbWikiSite.wikiArticleMarkupAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
261 | | - $.getJSON(targetArticleWikiApi, 'callback=?', function(data) { |
262 | | - var pages = data.query.pages; |
263 | | - if (pages) { |
264 | | - for (var i in pages) { |
265 | | - //if article data available |
266 | | - if (pages[i].revisions) { |
267 | | - callback(true); |
268 | | - return; |
269 | | - } |
270 | | - else { |
271 | | - callback(false); |
272 | | - return; |
273 | | - } |
274 | | - } |
275 | | - } |
276 | | - else { |
277 | | - callback(false); |
278 | | - } |
279 | | - }); |
280 | | - } |
281 | | - }, |
| 228 | + //gets inter wiki links for a given set of titles |
| 229 | + getInterWikiLinks: function(titles, optionalApiTags, interWikiLinksCallback) { |
| 230 | + if (titles && titles.length) { |
| 231 | + var urlData = wbUtil.stringFormat(this.wikiGetInterWikiLinksAPI, "en", encodeURIComponent(titles.replace("%20", " "))); |
| 232 | + if (optionalApiTags) { |
| 233 | + urlData = urlData + "&" + optionalApiTags; |
| 234 | + } |
282 | 235 | |
283 | | - //gets current page article title |
284 | | - //NOTE: we need to depend on wikipedia's javascript variables to get current article title |
285 | | - getCurrentArticleTitle: function() { |
286 | | - if (typeof wgTitle !== "undefined") { |
287 | | - if (wgAction === "view" && wgArticleId === 0 && wgIsArticle === false) { |
288 | | - return false; |
289 | | - } |
290 | | - //in addition to the page title, get the name space also if it exists. |
291 | | - if (typeof wgCanonicalNamespace !== "undefined" && wgCanonicalNamespace.length > 0) { |
292 | | - return wgCanonicalNamespace + ":" + wgTitle; |
293 | | - } |
294 | | - return wgTitle; |
295 | | - } |
296 | | - }, |
| 236 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 237 | + if (data) { |
| 238 | + interWikiLinksCallback(data, titles); |
| 239 | + } |
| 240 | + }); |
| 241 | + } |
| 242 | + }, |
297 | 243 | |
298 | | - //checks whether current page is wikipedia main page or not |
299 | | - //NOTE: we need to depend on wikipedia's javascript variables to check whether current page is main page or not |
300 | | - isWikiMainPage: function() { |
301 | | - return ((typeof wgPageName !== "undefined") && ((wgPageName === wgMainPageTitle) || (wgTitle === wgMainPageTitle))) ? true : false; |
302 | | - }, |
| 244 | + //gets the wiki edit page URL for the given title and language code |
| 245 | + getEditPageUrl: function(lang, title) { |
| 246 | + //if all the parameters are not null |
| 247 | + if (lang && lang.length && title && title.length) { |
| 248 | + return wbUtil.stringFormat(this.wikiEditUrl, lang, encodeURIComponent(title)); |
| 249 | + } |
| 250 | + }, |
303 | 251 | |
304 | | - //checks whether current domain is wikipedia or not |
305 | | - isWikiDomain: function(url) { |
306 | | - return (url.match(this.wikiPageUrlRegex) === null) ? false : true; |
307 | | - }, |
308 | | - //function to view the preview of the edited article |
309 | | - getPreviewContent: function(lang, composeText, callback) { |
310 | | - urlData = wbUtil.stringFormat(wbWikiSite.wikiPreviewAPI, lang, encodeURIComponent(composeText.replace(/<br>/gi, '').replace(/<br\/>/ig, '').replace('\'\'', '\'')).replace(/'/g, '%27')); |
311 | | - $.getJSON(urlData, 'callback=?', function(data) { |
312 | | - if (data && data.parse && data.parse.text) { |
313 | | - callback(data.parse.text['*']); |
314 | | - }else{ |
315 | | - callback(false); |
316 | | - } |
317 | | - }); |
318 | | - } |
319 | | - }; |
| 252 | + //gets the current article language code |
| 253 | + getCurrentLanguage: function() { |
| 254 | + return (typeof wikiSourceLanguage !== "undefined") ? wikiSourceLanguage : "en"; |
| 255 | + }, |
| 256 | + |
| 257 | + //checks for the given article availability in particular language. |
| 258 | + isArticleAvailable: function(lang, title, callback) { |
| 259 | + if (lang && lang.length && title && title.length) { |
| 260 | + var targetArticleWikiApi = wbUtil.stringFormat(wbWikiSite.wikiArticleMarkupAPI, lang, encodeURIComponent(title.replace("%20", " "))); |
| 261 | + $.getJSON(targetArticleWikiApi, 'callback=?', function(data) { |
| 262 | + var pages = data.query.pages; |
| 263 | + if (pages) { |
| 264 | + for (var i in pages) { |
| 265 | + //if article data available |
| 266 | + if (pages[i].revisions) { |
| 267 | + callback(true); |
| 268 | + return; |
| 269 | + } |
| 270 | + else { |
| 271 | + callback(false); |
| 272 | + return; |
| 273 | + } |
| 274 | + } |
| 275 | + } |
| 276 | + else { |
| 277 | + callback(false); |
| 278 | + } |
| 279 | + }); |
| 280 | + } |
| 281 | + }, |
| 282 | + |
| 283 | + //gets current page article title |
| 284 | + //NOTE: we need to depend on wikipedia's javascript variables to get current article title |
| 285 | + getCurrentArticleTitle: function() { |
| 286 | + if (typeof wgTitle !== "undefined") { |
| 287 | + if (wgAction === "view" && wgArticleId === 0 && wgIsArticle === false) { |
| 288 | + return false; |
| 289 | + } |
| 290 | + //in addition to the page title, get the name space also if it exists. |
| 291 | + if (typeof wgCanonicalNamespace !== "undefined" && wgCanonicalNamespace.length > 0) { |
| 292 | + return wgCanonicalNamespace + ":" + wgTitle; |
| 293 | + } |
| 294 | + return wgTitle; |
| 295 | + } |
| 296 | + }, |
| 297 | + |
| 298 | + //checks whether current page is wikipedia main page or not |
| 299 | + //NOTE: we need to depend on wikipedia's javascript variables to check whether current page is main page or not |
| 300 | + isWikiMainPage: function() { |
| 301 | + return ((typeof wgPageName !== "undefined") && ((wgPageName === wgMainPageTitle) || (wgTitle === wgMainPageTitle))) ? true : false; |
| 302 | + }, |
| 303 | + |
| 304 | + //checks whether current domain is wikipedia or not |
| 305 | + isWikiDomain: function(url) { |
| 306 | + return (url.match(this.wikiPageUrlRegex) === null) ? false : true; |
| 307 | + }, |
| 308 | + //function to view the preview of the edited article |
| 309 | + getPreviewContent: function(lang, composeText, callback) { |
| 310 | + urlData = wbUtil.stringFormat(wbWikiSite.wikiPreviewAPI, lang, encodeURIComponent(composeText.replace(/<br>/gi, '').replace(/<br\/>/ig, '').replace('\'\'', '\'')).replace(/'/g, '%27')); |
| 311 | + $.getJSON(urlData, 'callback=?', function(data) { |
| 312 | + if (data && data.parse && data.parse.text) { |
| 313 | + callback(data.parse.text['*']); |
| 314 | + }else{ |
| 315 | + callback(false); |
| 316 | + } |
| 317 | + }); |
| 318 | + } |
| 319 | + }; |
320 | 320 | })(); |
\ No newline at end of file |
Index: trunk/extensions/WikiBhasha/src/js/core/chineseLangSelection.js |
— | — | @@ -23,66 +23,66 @@ |
24 | 24 | |
25 | 25 | //make sure the namespace exists. |
26 | 26 | if (typeof (wikiBhasha.windowManagement) === "undefined") { |
27 | | - wikiBhasha.windowManagement = {}; |
| 27 | + wikiBhasha.windowManagement = {}; |
28 | 28 | } |
29 | 29 | |
30 | 30 | (function() { |
31 | | - wikiBhasha.windowManagement.chineseLangSelectionBox = { |
| 31 | + wikiBhasha.windowManagement.chineseLangSelectionBox = { |
32 | 32 | |
33 | | - windowId : "wbChineseLangSelectionWindow", |
| 33 | + windowId : "wbChineseLangSelectionWindow", |
34 | 34 | |
35 | | - show : function() { |
36 | | - var $chineseLangSelectionElement = $("#" + this.windowId); |
| 35 | + show : function() { |
| 36 | + var $chineseLangSelectionElement = $("#" + this.windowId); |
37 | 37 | |
38 | | - if ($chineseLangSelectionElement.length === 0) { |
39 | | - wbUIHelper.createWindow(this.windowId, wbGlobalSettings.chineseLangSelectionHTML); |
| 38 | + if ($chineseLangSelectionElement.length === 0) { |
| 39 | + wbUIHelper.createWindow(this.windowId, wbGlobalSettings.chineseLangSelectionHTML); |
40 | 40 | |
41 | | - //close the winow when user clicks on exit button |
42 | | - $("#wbCLSExitWindow").click(function() { |
43 | | - wbChineseLangSelection.hide(); |
44 | | - wbChineseLangSelection.deleteGlobalVariables(); |
45 | | - }); |
| 41 | + //close the winow when user clicks on exit button |
| 42 | + $("#wbCLSExitWindow").click(function() { |
| 43 | + wbChineseLangSelection.hide(); |
| 44 | + wbChineseLangSelection.deleteGlobalVariables(); |
| 45 | + }); |
46 | 46 | |
47 | | - //assigns the MTS language to zh-CHT |
48 | | - $("#wbCHTLangButton").click(function() { |
49 | | - wbGlobalSettings.mtTargetLanguageCode = 'zh-CHT'; |
50 | | - wikiBhasha.loadApplication(); |
51 | | - wbChineseLangSelection.hide(); |
52 | | - }); |
| 47 | + //assigns the MTS language to zh-CHT |
| 48 | + $("#wbCHTLangButton").click(function() { |
| 49 | + wbGlobalSettings.mtTargetLanguageCode = 'zh-CHT'; |
| 50 | + wikiBhasha.loadApplication(); |
| 51 | + wbChineseLangSelection.hide(); |
| 52 | + }); |
53 | 53 | |
54 | | - //assigns the MTS language to zh-CHS |
55 | | - $("#wbCHSLangButton").click(function() { |
56 | | - wbGlobalSettings.mtTargetLanguageCode = 'zh-CHS'; |
57 | | - wikiBhasha.loadApplication(); |
58 | | - wbChineseLangSelection.hide(); |
59 | | - }); |
60 | | - } |
61 | | - $chineseLangSelectionElement.maxZIndex({ inc: 5 }); |
62 | | - }, |
63 | | - //removes the window from memory |
64 | | - hide: function() { |
65 | | - wbUIHelper.hideLightBox(); |
66 | | - wbUIHelper.removeWindow(wbChineseLangSelection.windowId); |
67 | | - }, |
68 | | - //clean the objects from the memory |
69 | | - deleteGlobalVariables: function() { |
70 | | - var wbGlobalVariables = |
71 | | - ["baseUrl", |
72 | | - "s", |
73 | | - "wbGlobalSettings", |
74 | | - "wbChineseLangSelection", |
75 | | - "wbLanguageServices", |
76 | | - "wbLocal", |
77 | | - "wbSplash", |
78 | | - "wbUIHelper", |
79 | | - "wbUtil", |
80 | | - "wbWikiSite", |
81 | | - "wbWorkflow"]; |
82 | | - for (var i = 0; i < wbGlobalVariables.length; i++) { |
83 | | - window[wbGlobalVariables[i]] = undefined; |
84 | | - } |
85 | | - } |
86 | | - }; |
| 54 | + //assigns the MTS language to zh-CHS |
| 55 | + $("#wbCHSLangButton").click(function() { |
| 56 | + wbGlobalSettings.mtTargetLanguageCode = 'zh-CHS'; |
| 57 | + wikiBhasha.loadApplication(); |
| 58 | + wbChineseLangSelection.hide(); |
| 59 | + }); |
| 60 | + } |
| 61 | + $chineseLangSelectionElement.maxZIndex({ inc: 5 }); |
| 62 | + }, |
| 63 | + //removes the window from memory |
| 64 | + hide: function() { |
| 65 | + wbUIHelper.hideLightBox(); |
| 66 | + wbUIHelper.removeWindow(wbChineseLangSelection.windowId); |
| 67 | + }, |
| 68 | + //clean the objects from the memory |
| 69 | + deleteGlobalVariables: function() { |
| 70 | + var wbGlobalVariables = |
| 71 | + ["baseUrl", |
| 72 | + "s", |
| 73 | + "wbGlobalSettings", |
| 74 | + "wbChineseLangSelection", |
| 75 | + "wbLanguageServices", |
| 76 | + "wbLocal", |
| 77 | + "wbSplash", |
| 78 | + "wbUIHelper", |
| 79 | + "wbUtil", |
| 80 | + "wbWikiSite", |
| 81 | + "wbWorkflow"]; |
| 82 | + for (var i = 0; i < wbGlobalVariables.length; i++) { |
| 83 | + window[wbGlobalVariables[i]] = undefined; |
| 84 | + } |
| 85 | + } |
| 86 | + }; |
87 | 87 | |
88 | 88 | wbChineseLangSelection = wikiBhasha.windowManagement.chineseLangSelectionBox; |
89 | 89 | |
Index: trunk/extensions/WikiBhasha/src/js/core/templateAndLinkTranslator.js |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | //Make sure the base namespace exists. |
20 | 20 | |
21 | 21 | if (typeof (wikiBhasha.contentManagement) === "undefined") { |
22 | | - wikiBhasha.contentManagement = {}; |
| 22 | + wikiBhasha.contentManagement = {}; |
23 | 23 | } |
24 | 24 | |
25 | 25 | // Class: templatesAndLinksTranslator |
Index: trunk/extensions/WikiBhasha/src/js/core/configurations.templateMappers.js |
— | — | @@ -55,28 +55,28 @@ |
56 | 56 | // Make sure the base namespace exists. |
57 | 57 | // includes all the available configurations for the application. |
58 | 58 | if (typeof (wikiBhasha.configurations) === "undefined") { |
59 | | - wikiBhasha.configurations = {}; |
| 59 | + wikiBhasha.configurations = {}; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // describes the configuration required for template mapping from source language article to target language article. |
63 | 63 | wikiBhasha.configurations.templateMappers = { |
64 | 64 | templateMapConfig :'<?xml version="1.0"?>\ |
65 | | - <templateMapConfig>\ |
66 | | - <templateMapBetweenLangPair srcLang="en" tgtLang="ja">\ |
67 | | - <templateMap srcTemplateName="EnTemplate1" tgtTemplateName="JaTempalte1">\ |
68 | | - <param srcTemplateParamName="EnTemAttr1" tgtTemplateParamName="JaTemAttr1"/>\ |
69 | | - <param srcTemplateParamName="EnTemAttr2" tgtTemplateParamName="JaTemAttr2"/>\ |
70 | | - </templateMap>\ |
71 | | - </templateMapBetweenLangPair>\ |
72 | | - <templateMapBetweenLangPair srcLang="en" tgtLang="hi">\ |
73 | | - <templateMap srcTemplateName="Age in weeks" tgtTemplateName="उमर_सप्ताह_मे">\ |
74 | | - <param srcTemplateParamName="month1" tgtTemplateParamName="महिना1"/>\ |
75 | | - <param srcTemplateParamName="day1" tgtTemplateParamName="दिन1"/>\ |
76 | | - <param srcTemplateParamName="year1" tgtTemplateParamName="साल1"/>\ |
77 | | - <param srcTemplateParamName="month2" tgtTemplateParamName="महिना2"/>\ |
78 | | - <param srcTemplateParamName="day2" tgtTemplateParamName="दिन2"/>\ |
79 | | - <param srcTemplateParamName="year2" tgtTemplateParamName="साल2"/>\ |
80 | | - </templateMap>\ |
81 | | - </templateMapBetweenLangPair>\ |
82 | | - </templateMapConfig>' |
| 65 | + <templateMapConfig>\ |
| 66 | + <templateMapBetweenLangPair srcLang="en" tgtLang="ja">\ |
| 67 | + <templateMap srcTemplateName="EnTemplate1" tgtTemplateName="JaTempalte1">\ |
| 68 | + <param srcTemplateParamName="EnTemAttr1" tgtTemplateParamName="JaTemAttr1"/>\ |
| 69 | + <param srcTemplateParamName="EnTemAttr2" tgtTemplateParamName="JaTemAttr2"/>\ |
| 70 | + </templateMap>\ |
| 71 | + </templateMapBetweenLangPair>\ |
| 72 | + <templateMapBetweenLangPair srcLang="en" tgtLang="hi">\ |
| 73 | + <templateMap srcTemplateName="Age in weeks" tgtTemplateName="उमर_सप्ताह_मे">\ |
| 74 | + <param srcTemplateParamName="month1" tgtTemplateParamName="महिना1"/>\ |
| 75 | + <param srcTemplateParamName="day1" tgtTemplateParamName="दिन1"/>\ |
| 76 | + <param srcTemplateParamName="year1" tgtTemplateParamName="साल1"/>\ |
| 77 | + <param srcTemplateParamName="month2" tgtTemplateParamName="महिना2"/>\ |
| 78 | + <param srcTemplateParamName="day2" tgtTemplateParamName="दिन2"/>\ |
| 79 | + <param srcTemplateParamName="year2" tgtTemplateParamName="साल2"/>\ |
| 80 | + </templateMap>\ |
| 81 | + </templateMapBetweenLangPair>\ |
| 82 | + </templateMapConfig>' |
83 | 83 | }; |