See PR #665 <https://github.com/weewx/weewx/pull/665>

Karen K schrieb am Sonntag, 28. März 2021 um 14:37:21 UTC+2:

> *More detailed description of usage and possibilities:*
>
> Instead of using label tags directly, they are prepended by the $locale 
> tag. $locale provides a language dependent label string if some is 
> available und otherwise the entry from weewx.conf or skin.conf
>   
> Example:
>     $locale.obs.label.outTemp
>
> The extension looks for an entry in the appropriate localization file. If 
> it finds one it returns it. If it finds no entry the value from skin_dict 
> (weewx.conf or skin.conf) is returned.
>
> For template dependent labels use Cheetah variable as parameter to the 
> $locale tag.
>   
> Example:
>     #set $page = "mypage"
>     $locale(tmpl=$page).html_description
>     
> This tag is first looked up in the [Templates] section of the localization 
> file in the subsection defined by (in this example) $page. If it is found 
> there, it is used. If it is not found there, the entry in section 
> [Labels][[Generic]] is used, either from skin.conf or weewx.conf. In 
> general you would have the #set line at the beginning of the template file 
> and the $locale line within some #include file, called from that template 
> file. It replaces long #if - #if else etc. constructs as found in several 
> skins today by a single line.
>
> To make lookup more flexible, it is also possible to provide the label 
> entry as a parameter to $locale.
>   
> Example:
>     #set $mylabel = "outTemp"
>     #set $xxx = 'obs.label'+$mylabel
>     $locale(tag=$xxx)
>   
> That looks for $locale.obs.label.outTemp, too. It may be useful in Cheetah 
> loops.
>   
> The extension needs an additional entry called 'lang_file' directly in the 
> skin section of weewx.conf. It points to the localization file to use. 
> Relative paths are relative to the skin directory.
>   
> The localization file has the same structure as the skin.conf file. 
> Entries that depend on language need to be defined there, only. Other 
> entries remain defined in weewx.conf or skin.conf
>   
> The localization file is not restricted to "Extras" and "Labels" section, 
> but can process all sections of the file.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/4dc1ed8d-32f6-480a-8eab-deab8f2ec5c3n%40googlegroups.com.

Reply via email to