Skip to content

Commit

Permalink
Added lang member (closes #322)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Mar 4, 2015
1 parent 0033f23 commit cbd8343
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions index.html
Expand Up @@ -110,6 +110,7 @@ <h3>
</p>
<pre class="example highlight json" title="typical manifest">
{
"lang": "en",
"name": "Super Racer 2000",
"short_name": "Racer2K",
"icons": [{
Expand Down Expand Up @@ -706,6 +707,7 @@ <h3>
Content-Type: application/manifest+json

{
"lang": "en",
"name": "Super Racer 2000",
"start_url": "/start.html",
"display": "fullscreen",
Expand Down Expand Up @@ -838,6 +840,10 @@ <h3>
of running the <a>steps for processing the <code>name</code>
member</a> with <var>manifest</var> as the argument.
</li>
<li>Let <var>language</var> of <var>parsed manifest</var> be the
result of running the <a>steps for processing the <code>lang</code>
member</a> with <var>manifest</var> as the argument.
</li>
<li>Let <var>short name</var> of <var>parsed manifest</var> be the
result of running the <a>steps for processing the
<code>short_name</code> member</a> with <var>manifest</var> as the
Expand Down Expand Up @@ -940,6 +946,41 @@ <h2>
Every manifest has an associated <dfn>manifest URL</dfn>, which the
[[!URL]] from which the <a>manifest</a> was fetched.
</p>
<section>
<h3>
<code title="">lang</code> member
</h3>
<p>
The <dfn id="member-lang"><code>lang</code></dfn> member is a
[[!BCP47]] language tag (string) that specifies the primary language
for the values of the manifest's <code>name</code> and
<code>short_name</code> members.
</p>
<p>
The <dfn>steps for processing the <code>lang</code> member</dfn> is
given by the following algorithm. The algorithm takes a
<var>manifest</var> as an argument. This algorithm returns a string
or <code>undefined</code>.
</p>
<ol>
<li>Let <var>value</var> be the result of calling the
<a>[[\GetOwnProperty]]</a> internal method of <var>manifest</var>
with argument "<code>name</code>".
</li>
<li>If <a>Type</a>(<var>value</var>) is not "string":
<ol>
<li>If <a>Type</a>(<var>value</var>) is not "undefined",
optionally <a>issue a developer warning</a> that the type is not
supported.
</li>
<li>Return <code>undefined</code>.
</li>
</ol>
</li>
<li>Otherwise, <a>Trim</a>(<var>value</var>) and return the result.
</li>
</ol>
</section>
<section>
<h3>
<code title="">name</code> member
Expand Down

5 comments on commit cbd8343

@kenchris
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this supposed to be used? What if the site works just as well in more than one lang?

@kenchris
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoding languages doesn't seem to help i18n, but might actually do the opposite

@marcoscaceres
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this supposed to be used? What if the site works just as well in more than one lang?

It's for the "primary" language. You can still have multiple languages.

hardcoding languages doesn't seem to help i18n, but might actually do the opposite.

Maybe, but it's the best we can do with JSON (define the primary lang). It's doesn't give us the flexibility of XML (we solved all this stuff easily with XML, but here it's basically impossible without making a huge mess). We went JSON, so let's just live with it.

@kenchris
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it is probably fine. I actually think that adding all different languages in one manifest file is the wrong approach (bigger download, slower parsing etc) and the .desktop format on Linux showed that.

Generating the manifest.json on the server and defining what language it is in should be fine... maybe some words on i18n and generating the manifest on the server?

@marcoscaceres
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generating the manifest.json on the server and defining what language it is in should be fine... maybe some words on i18n and generating the manifest on the server?

Precisely what #323 is about :)

Please sign in to comment.