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

Parse language information #3

Open
voxpelli opened this Issue Jul 13, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@voxpelli

After discussion on IRC, opening an issue here for the language parsing brainstorming that's happened on the wiki:

http://microformats.org/wiki/microformats2-parsing-brainstorming#Parse_language_information

@voxpelli

This comment has been minimized.

Show comment
Hide comment
@voxpelli

voxpelli Aug 14, 2016

Adding some issue references for related issues to make discovery easier:

microformats/php-mf2#96
glennjones/microformat-shiv#22
w3c/Micropub#34 (comment) about similar syntax for parsing img alt text as discussed in #2 in this repo

voxpelli commented Aug 14, 2016

Adding some issue references for related issues to make discovery easier:

microformats/php-mf2#96
glennjones/microformat-shiv#22
w3c/Micropub#34 (comment) about similar syntax for parsing img alt text as discussed in #2 in this repo

@BigBlueHat

This comment has been minimized.

Show comment
Hide comment
@BigBlueHat

BigBlueHat Sep 22, 2016

This is worth digging into for examples and variations on use of the lang attribute in HTML5 (etc) and the fallback list/process to figure out the containing documents language--which may be as "far away" as the HTTP header values.

Here's a clear example that shows some of the "gotchas":

Bad example: <a lang="es" title="Spanish" href="qa-html-language-declarations.es">Español</a>

vs.

Good example: <span title="Spanish"><a lang="es" href="qa-html-language-declarations.es">Español</a></span>

https://www.w3.org/International/questions/qa-html-language-declarations#contentvsattribute

Hope that's helpful. It's research I was doing while discussing w3c/webmention#57

Cheers!

BigBlueHat commented Sep 22, 2016

This is worth digging into for examples and variations on use of the lang attribute in HTML5 (etc) and the fallback list/process to figure out the containing documents language--which may be as "far away" as the HTTP header values.

Here's a clear example that shows some of the "gotchas":

Bad example: <a lang="es" title="Spanish" href="qa-html-language-declarations.es">Español</a>

vs.

Good example: <span title="Spanish"><a lang="es" href="qa-html-language-declarations.es">Español</a></span>

https://www.w3.org/International/questions/qa-html-language-declarations#contentvsattribute

Hope that's helpful. It's research I was doing while discussing w3c/webmention#57

Cheers!

@tantek

This comment has been minimized.

Show comment
Hide comment
@tantek

tantek Sep 22, 2016

Member

That:

Good example:

<span title="Spanish">
<a lang="es" href="qa-html-language-declarations.es">Español</a>
</span>

Seems like it could be improved with:

Better(?) example:

<span title="Spanish" lang="en">
<a lang="es" hreflang="es" href="qa-html-language-declarations.es">Español</a>
</span>

Assuming that the document at "qa-html-language-declarations.es" is also in Spanish.

Member

tantek commented Sep 22, 2016

That:

Good example:

<span title="Spanish">
<a lang="es" href="qa-html-language-declarations.es">Español</a>
</span>

Seems like it could be improved with:

Better(?) example:

<span title="Spanish" lang="en">
<a lang="es" hreflang="es" href="qa-html-language-declarations.es">Español</a>
</span>

Assuming that the document at "qa-html-language-declarations.es" is also in Spanish.

@BigBlueHat

This comment has been minimized.

Show comment
Hide comment
@BigBlueHat

BigBlueHat Sep 22, 2016

@tantek could you code "fence" those so the markup's viewable?

What I'm seeing in the console, though, does clarify the URL's meaning, but doesn't deal with title if that was in English. For example:

<html lang="en">
...
Bestest(?) example:
<a title="Not actually in Spanish"
   hreflang="jp" href="http://example.jp/"
   lang="es">Español</a>
...
</html>

That covers all the cases I know of...right now...today. 😜

BigBlueHat commented Sep 22, 2016

@tantek could you code "fence" those so the markup's viewable?

What I'm seeing in the console, though, does clarify the URL's meaning, but doesn't deal with title if that was in English. For example:

<html lang="en">
...
Bestest(?) example:
<a title="Not actually in Spanish"
   hreflang="jp" href="http://example.jp/"
   lang="es">Español</a>
...
</html>

That covers all the cases I know of...right now...today. 😜

@tantek

This comment has been minimized.

Show comment
Hide comment
@tantek

tantek Sep 22, 2016

Member

I think I did? Took a few edits. markdown-- :P

Member

tantek commented Sep 22, 2016

I think I did? Took a few edits. markdown-- :P

@gRegorLove

This comment has been minimized.

Show comment
Hide comment
@gRegorLove

gRegorLove Jun 26, 2018

Member

php-mf2 supports this behind a feature flag as of 0.3.2 https://github.com/indieweb/php-mf2/releases/tag/v0.3.2

microformat-shiv supports this as of 2.0 glennjones/microformat-shiv#22

Still pending confirmation from a consumer that this gives the expected result / no issues.

Member

gRegorLove commented Jun 26, 2018

php-mf2 supports this behind a feature flag as of 0.3.2 https://github.com/indieweb/php-mf2/releases/tag/v0.3.2

microformat-shiv supports this as of 2.0 glennjones/microformat-shiv#22

Still pending confirmation from a consumer that this gives the expected result / no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment