W3C home > Mailing lists > Public > public-multilingualweb-lt@w3.org > July 2012

RE: [ACTION 107] Locale Filter

From: Yves Savourel <ysavourel@enlaso.com>
Date: Tue, 17 Jul 2012 06:05:57 +0200
To: <public-multilingualweb-lt@w3.org>
Message-ID: <assp.0545eb0d0a.assp.0545762cd6.005201cd63d1$78f8d320$6aea7960$@com>
Hi Shaun, all,

+1 in general, with only two comments:


1) It would be nice to have a direct reference to what 'basic filtering' is.

2) While I agree that the syntax of the language priority list used in the example of RFC 4647 is the way to go it seems that talking about "language priority list" is confusing. Such list is defined as "a prioritized or weighted list of language ranges" (http://tools.ietf.org/html/rfc4647#section-2.3) But our usage does not include any prioritization aspect.

Maybe we could simply talk about a list of basic language ranges. Something like:


---start---

The Locale Filter data category associates with each selected node a filter type and a list of locale identifiers. That list is a comma-separated list of basic language ranges as defined in RFC-4647 section 2.1. whitespace surrounding language ranges is ignored."

...

* "include": The node is only included in locales that match at least one language range in the list using basic filtering as defined in RFC-4647 section 3.3.1

* "exclude": The node is included in all locales except those that match at least one language range in the list using basic filtering as defined in RFC-4647 section 3.3.1.

If the locale filter type is "all" or "none", a list SHOULD NOT be provided. If one is, it MUST be ignored. If the locale filter type is "include" or "exclude", a list SHOULD be provided. If one is not, it MUST default to the empty list.

...

Implementations MUST NOT combine lists from multiple rules or local attributes.

... etc.

---end---


Cheers,
-yves


-----Original Message-----
From: Shaun McCance [mailto:shaunm@gnome.org] 
Sent: Monday, July 16, 2012 11:49 PM
To: public-multilingualweb-lt@w3.org
Subject: Re: [ACTION 107] Locale Filter

Here's a second take on locale filter. Felix recommended using a language range from RFC 4647. In fact, we want a priority list of language ranges. RFC 4647 does not define the syntax for these, but it defines semantics. [Section 2.3] It uses a comma-separated list as an example syntax. I used that.

http://tools.ietf.org/html/rfc4647

Also, I've decided to use basic language ranges rather than extended language ranges. [Sections 2.1, 2.2, 3.3.1, 3.3.2] Basic ranges either match exactly or match initial substrings with a hyphen. You can use '*' to mean "anything", but you can't use it as a subtag, e.g. '*-CH'. If you want to filter for a region, you'll have to enumerate the languages, e.g.
'de-CH, fr-CH, it-CH'.

I chose basic filtering because I think the algorithm for extended filtering is tricky (but not impossible) to do in XSLT 1.0, at least without EXSLT. Basic filtering is easy.
If anybody feels strongly that we should use extended filtering, speak up. I'm not really opposed.

If there's no objections, I'll put together some examples and add this to the ODD file.


= Locale Filter

== Definition

The Locale Filter data category specifies that a node is only applicable to certain locales, or that it is not applicable to certain locales.

This data category can be used for several purposes, including, but not limited to:

 * Include a legal notice only in locales for certain regions.
 * Drop editorial notes from all localized output.

The Locale Filter data category associates with each selected node a filter type and a language priority list conforming to RFC 4647. The language priority list is a comma-separated list of basic language ranges. Whitespace surrounding language ranges is ignored.

The locale filter type can take the following values:


 * "all": The node is included in all locales.
 * "none": The node is included in no locales.
 * "include": The node is only included in locales that match
   at least one language range in the language priority list
   using basic filtering.
 * "exclude": The node is included in all locales except those
   that match at least one language range in the language priority
   list using basic filtering.


If the locale filter type is "all" or "none", a language priority list SHOULD NOT be provided. If one is, it MUST be ignored. If the locale filter type is "include" or "exclude", a language priority list SHOULD be provided. If one is not, it MUST default to the empty list.

== Implementation

The Locale Filter data category can be expressed with global rules, or locally on an individual element. The information applies to the textual content of the element, including child elements and attributes. The default is that the locale filter type is "all".

Implementations MUST NOT combine language priority lists from multiple rules or local attributes.

GLOBAL: The localeFilterRule element contains the following:

 * A required selector attribute. It contains an XPath expression
   which selects the nodes to which this rule applies.

 * A required localeFilterType attribute with the value "all",
   "none", "include", or "exclude".

 * An optional localeFilterList attribute with a comma-separated
   language priority list.

LOCAL: The following local markup is available for the Locale Filter data category:

 * A localeFilterType attribute with the value "all", "none",
   "include", or "exclude".

 * A localFilterList attribute with a comma-separated language
   priority list.
Received on Tuesday, 17 July 2012 04:06:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:31:47 UTC