我想使用这个 conky 脚本:康基愿景
但我不希望一周中的几天以英语显示。
当我将区域设置更改为另一种语言时,今天会以该语言显示,但图像下部的 5 天名称始终为英语,即使我将系统语言更改为其他语言也是如此。
我也更改了系统语言,但那些日子仍然显示为英文。
我应该对该脚本进行哪些更改才能使其遵循我想要的语言?
conkyrc 文件包含以下内容:
# Conky settings #
background yes
update_interval 1
double_buffer yes
no_buffers yes
# Window specifications #
gap_x 0
gap_y 0
alignment middle_middle
minimum_size 600 460
maximum_width 600
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_argb_visual yes
own_window_argb_value 255
#border_margin 0
#border_inner_margin 0
#border_outer_margin 0
# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
# Text settings #
use_xft yes
xftalpha 0
xftfont Raleway:size=10
override_utf8_locale yes
imlib_cache_size 0
# Color scheme #
default_color FFFFFF
color1 FFFFFF
TEXT
\
#-----WOIED-----#
\
\
${execi 300 curl -s "http://weather.yahooapis.fr/forecastrss?w=615702&u=c" -o ~/.cache/weather.xml}\
\
\
#---Clock+Date---#
\
\
${font Raleway:weight=Light :size=100}${alignc}${time %H}${alignc}:${alignc}${time %M}
${font Raleway:weight=Light:size=32}${voffset -60}${alignc}${time %A %B %d}\
\
\
#---High Temperatures---#
\
\
${font Raleway:size=20}\
${voffset 76}${goto 40}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°
${font Raleway:weight=Light:size=14}\
${voffset -28}${goto 160}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°\
${goto 270}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°\
${goto 380}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°\
${goto 490}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°\
\
\
#---Low Temparatures---#
\
\
${font Raleway:weight=Light:size=10}\
${voffset 48}${goto 210}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°\
${goto 320}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°\
${goto 430}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°\
${goto 540}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°\
\
\
#---Name of the day---#
\
\
${font Raleway:weight=Light:size=14}\
${voffset 30}${goto 60}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1' | tr '[a-z]' '[A-Z]'}\
${goto 170}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' | tr '[a-z]' '[A-Z]'}\
${goto 280}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' | tr '[a-z]' '[A-Z]'}\
${goto 390}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4' | tr '[a-z]' '[A-Z]'}\
${goto 500}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5' | tr '[a-z]' '[A-Z]'}\
\
\
#---Weather Icons---#
\
\
${execi 300 cp -f ~/.conky-vision-icons/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather-1.png}${image ~/.cache/weather-1.png -p 61,260 -s 32x32}\
\
${execi 300 cp -f ~/.conky-vision-icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2').png ~/.cache/weather-2.png}${image ~/.cache/weather-2.png -p 171,260 -s 32x32}\
\
${execi 300 cp -f ~/.conky-vision-icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3').png ~/.cache/weather-3.png}${image ~/.cache/weather-3.png -p 281,260 -s 32x32}\
\
${execi 300 cp -f ~/.conky-vision-icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4').png ~/.cache/weather-4.png}${image ~/.cache/weather-4.png -p 391,260 -s 32x32}\
\
${execi 300 cp -f ~/.conky-vision-icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5').png ~/.cache/weather-5.png}${image ~/.cache/weather-5.png -p 501,260 -s 32x32}${font}${voffset -46}\
它似乎与~/.cache/weather.xml
该文件有关(更多详细信息这里)。
该文件包含如下行:
<yweather:forecast day="Fri" date="10 Jul 2015" low="14" high="26" text="Mostly Sunny" code="34" />
<yweather:forecast day="Sat" date="11 Jul 2015" low="15" high="27" text="Mostly Sunny" code="34" />
<yweather:forecast day="Sun" date="12 Jul 2015" low="14" high="22" text="Showers" code="11" />
<yweather:forecast day="Mon" date="13 Jul 2015" low="16" high="24" text="Cloudy" code="26" />
<yweather:forecast day="Tue" date="14 Jul 2015" low="12" high="23" text="AM Showers" code="39" />
我想,正如评论中所示,下面的命令---Name of the day---#
正在.conkyrc
编写和更新上面发布的行~/.cache/weather.xml
(包含英文的日期名称)。但正如我所见,这些命令仅与“yweather:forecast”相关,这可能意味着英语中的日期是curl
从 yahoo 天气 English_US 网站上抓取的,这就是为什么它们是英语的。
但令我感兴趣的是,当我第一次看到这个 conky 时一个西班牙语网站,所有内容都是西班牙语。看来 PPA 不再起作用了。
我使用的是 Primary OS Freya(基于 *ubuntu 14.04)
答案1
我是那个 conky 主题的创造者。 :)
日期名称在 xml 文件中提供,而 yahoo 的 API 仅提供英语。
您可以使用“execi”并运行 date 命令来显示所有日期,并使用 LANG 变量更改输出语言。
这是一个例子:
#---Names of days---#
\
\
${font Raleway:weight=Light:size=14}\
${voffset 30}${goto 60}${execi 300 LANG=es_ES.UTF-8 date +%a | awk '{print toupper($0)}'}\
${goto 170}${execi 300 LANG=es_ES.UTF-8 date -d +1day +%a | awk '{print toupper($0)}'}\
${goto 280}${execi 300 LANG=es_ES.UTF-8 date -d +2days +%a | awk '{print toupper($0)}'}\
${goto 390}${execi 300 LANG=es_ES.UTF-8 date -d +3days +%a | awk '{print toupper($0)}'}\
${goto 500}${execi 300 LANG=es_ES.UTF-8 date -d +4days +%a | awk '{print toupper($0)}'}\
更新:
上述内容(以及问题)与此 conky 脚本的旧版本有关。
这新版本的 Conky Visions(需要conky
1.10版本(这里)并且jq
为了工作,以及不同的字体)可以通过编辑.conkyrc
区域设置行轻松设置不同的语言,模板 9:
-------------------------------------
-- Locale (e.g. "es_ES.UTF-8")
-- Leave empty for default
-------------------------------------
template9=""