Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using ITS "Locale Filter" instead of data-lang #76

Closed
fsasaki opened this issue Jul 21, 2015 · 10 comments
Closed

Consider using ITS "Locale Filter" instead of data-lang #76

fsasaki opened this issue Jul 21, 2015 · 10 comments

Comments

@fsasaki
Copy link

fsasaki commented Jul 21, 2015

Looking at the data-lang attribute the functionality seems identical to ITS "Locale Filter"

http://www.w3.org/TR/its20/#LocaleFilter

One should consider replacing data-lang with the standardized "Locale Filter" mechanism. This would be relatively easy:

  1. at the top of https://github.com/w3c/clreq/blob/gh-pages/index.html add its-locale-filter-list="*" its-locale-filter-type="exclude"

  2. replace all data-lang attributes with an its-locale-filter-list attribute. Its value is the same like for data-lang

  3. replace in
    https://github.com/w3c/clreq/blob/gh-pages/script.js
    and in the CSS selectors all selectors for data-lang with a selector for its-locale-filter-list

Note that locale-filter is also understood by the w3c validator, so your document will keep to be valid, see this example

https://validator.w3.org/nu/?doc=http%3A%2F%2Fwww.w3.org%2FTR%2Fits20%2Fexamples%2Fhtml5%2FEX-locale-filter-local-html5-1.html

@r12a
Copy link
Contributor

r12a commented Jul 21, 2015

we don't actually need step 1, so it comes down to replacing all occurences of data-lang with its-locale-filter-list, which is an ITS defined name.

the downside is that it takes 2.5 times as long to type the attribute name for a content author, and since these attributes come in pairs, that's 5x the typing for each chunk of data labelled. Plus it makes the code marginally harder to read. In reality, ITS only defines data categories, and the actual names of attributes in the implementation don't have to be the same, just behave in the same way (so eg. in HTML we use the translate attribute rather than the its-translate attribute). That's less of a problem if we are copy-pasting.

but i guess it makes sense to use the same attribute name as in the ITS standard. One advantage being that it is clearer to people why this attribute is not the same as using the lang attribute, another is that it shows that we are using ITS concepts. (Note also that its-locale-filter-list validates.)

i guess we could try it, and if it's too long we could revert back to data-lang, or even data-locale.

@fsasaki
Copy link
Author

fsasaki commented Jul 23, 2015

I had assumed that this would now be implemented at
http://www.w3.org/TR/2015/WD-clreq-20150723/
but that does not seem to be the case. Was this a timing issue with the working draft publication?

@r12a
Copy link
Contributor

r12a commented Jul 24, 2015

i'm waiting for opinions from the group

i'm a little worried about the length of its-locale-filter-list. I'm inclined to think that it will reduce the readability of the source in github diffs and become a pain for manual editing, especially as we are about to add a third 'language' to the document (Simplified Chinese). I think we can certainly say, however, that data-lang represents a local instantiation of the locale filter data category.

@fsasaki
Copy link
Author

fsasaki commented Jul 24, 2015

Strange - I understood during our 1:1 call this week that you would move forward with its-locale-filter-list.
Keeping data-lang would be a pitty in terms of "dog fooding". We develop ITS2, reviewed by the i18n group, with no complains about attribute length. And then it comes to adoption the length concerns come up?
About "we can certainly say, however, that data-lang represents a local instantiation of the locale filter data category.": this does not help if you don't have a mapping between data-lang and the its-locale-filter-list. You can achieve that mapping via a rules files in the HTML "head" element:
<script type=application/its+xml>
<its:rules version="2.0" xmlns:its="http://www.w3.org/2005/11/its" its:version="2.0">
<its:localeFilterRule selector="//@[@data-lang='zh']" localeFilterList="zh"/>
<its:localeFilterRule selector="//@[@data-lang='en']" localeFilterList="en"/>
</its:rules>
</script>
This solution is not preferred because people will continue to use proprietary attributes.

@ysavourel
Copy link

I tend to agree with Felix.

Using the ITS attribute allows ITS processors to understand the file without having to do any mapping, and after all it is just following the W3C's own recommendation.

It's also a case different from translate, where the ITS specification does use the native HTML attribute (there is no its-translate).

@DavidFatDavidF
Copy link

The mapping through script is an afterthought and would have to be used if the right thing could not be done upfront.
I don't think that the argument about the length of the attribute will hold. Who edits totally manually nowadays? Every decent editor will autocomplete the attribute name.
+1 for dog fooding, why reinvent the wheel?

r12a added a commit that referenced this issue May 14, 2019
This addresses #76
I will update the script and styling to match in a following commit.
@xfq
Copy link
Member

xfq commented May 20, 2019

Can we close this issue now?

@r12a
Copy link
Contributor

r12a commented May 20, 2019

Ok to close from my pov.

@r12a
Copy link
Contributor

r12a commented May 20, 2019

Perhaps we should add that we are closing the issue because we implemented the proposal - replacing data-lang with its-locale-filter-list throughout.

@xfq
Copy link
Member

xfq commented May 20, 2019

OK. Closing.

@xfq xfq closed this as completed May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants