mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix bug causing dates for downloaded news to be in Spanish. Fixes #2198 (Bug fix of recipe La Prensa - Nicaragua)
This commit is contained in:
parent
a45cc97f90
commit
e13c15f8e6
@ -6,7 +6,7 @@ __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
|||||||
laprensa.com.ni
|
laprensa.com.ni
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import locale
|
import datetime
|
||||||
import time
|
import time
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
@ -23,23 +23,9 @@ class LaPrensa_ni(BasicNewsRecipe):
|
|||||||
encoding = 'cp1252'
|
encoding = 'cp1252'
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
language = _('Spanish')
|
language = _('Spanish')
|
||||||
|
months_es = ['enero','febrero','marzo','abril','mayo','junio','julio','agosto','septiembre','octubre','noviembre','diciembre']
|
||||||
#Locale setting to get appropriate date/month values in Spanish
|
current_month = months_es[datetime.date.today().month - 1]
|
||||||
try:
|
current_index = time.strftime("http://www.laprensa.com.ni/archivo/%Y/" + current_month + "/%d/noticias/")
|
||||||
#Windows seting for locale
|
|
||||||
locale.setlocale(locale.LC_TIME,'Spanish_Nicaragua')
|
|
||||||
except locale.Error:
|
|
||||||
#Linux setting for locale -- choose one appropriate for your distribution
|
|
||||||
try:
|
|
||||||
locale.setlocale(locale.LC_TIME,'es_NI')
|
|
||||||
except locale.Error:
|
|
||||||
try:
|
|
||||||
locale.setlocale(locale.LC_TIME,'es_ES')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
current_index = time.strftime("http://www.laprensa.com.ni/archivo/%Y/%B/%d/noticias/")
|
|
||||||
|
|
||||||
html2lrf_options = [
|
html2lrf_options = [
|
||||||
'--comment', description
|
'--comment', description
|
||||||
@ -91,6 +77,3 @@ class LaPrensa_ni(BasicNewsRecipe):
|
|||||||
totalfeeds.append((feedtitle, articles))
|
totalfeeds.append((feedtitle, articles))
|
||||||
return totalfeeds
|
return totalfeeds
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
#Going back to the default locale
|
|
||||||
locale.setlocale(locale.LC_TIME,'')
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user