-
Notifications
You must be signed in to change notification settings - Fork 162
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
WIP: add localizable dictionary #358
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d743b7f
WIP: add localizable dictionary
marcoscaceres bf5bcb0
Split up Localizable and TextDirection. (#1)
tobie 381de47
fix some wording as suggested by Annevk
marcoscaceres 97f6d52
Make it clear that it's one or more paragraphs
marcoscaceres bc58e24
members should be plural
marcoscaceres e78d5f5
Adds LocalizableString enum
marcoscaceres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12751,6 +12751,68 @@ type is used for representing function values that take no arguments and do not | |
return any value. | ||
|
||
|
||
<h3 id="TextDirection" enum>TextDirection</h3> | ||
|
||
<pre class="idl"> | ||
enum TextDirection { | ||
"auto", | ||
"ltr", | ||
"rtl" | ||
}; | ||
</pre> | ||
|
||
The {{TextDirection}} [=enumerable=] is used to represent text directionality as described in [[!BIDI]]. | ||
|
||
|
||
<h3 id="localizable" dictionary>Localizable</h3> | ||
|
||
A <dfn export>localizable member</dfn> is a [=dictionary member=] that | ||
represents a bidirectional algorithm paragraph when displayed, | ||
as defined by the bidirectional algorithm’s rules P1, P2, and P3, | ||
including, for instance, supporting the paragraph-breaking behavior | ||
of <span class="char">U+000A LINE FEED (LF)</span> characters. [[!BIDI]] | ||
|
||
A user agent is expected to honor the Unicode semantics of [=localizable members=]. | ||
|
||
The [=identifier=] of a [=localizable member=] is left to the defining specification (e.g., "title"). | ||
|
||
Dictionaries that specify a [=localizable member=] must inherit from the {{Localizable}} dictionary. | ||
|
||
Specification authors must specify in prose which [=dictionary members|member(s)=] | ||
of the inheriting dictionary serve as [=localizable members=]. | ||
|
||
Specification authors should limit the number of [=localizable members=] to one per dictionary, | ||
including in [=inherited dictionaries=] (if any). | ||
|
||
<pre class="idl"> | ||
dictionary Localizable { | ||
DOMString lang = ""; | ||
TextDirection dir = "auto"; | ||
}; | ||
</pre> | ||
|
||
The {{Localizable/lang}} member specifies the primary language for the [=dictionary members=] | ||
which are [=localizable members=]. | ||
Its value is a {{DOMString}}. | ||
The empty string indicates that the primary language is unknown. | ||
Any other string must be interpreted as a language tag. | ||
Validity or well-formedness are not enforced. [[!BCP47]] | ||
|
||
For the [=localizable member=], the {{Localizable/dir}} member provides the higher-level override of rules P2 and P3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be plural. It's not just one. |
||
if it has a value other than <a for=TextDirection enum-value>"auto"</a>. [[!BIDI]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be more clearly made to apply to the localizable members. |
||
|
||
<div class=example> | ||
<pre highlight="webidl"> | ||
dictionary PaymentItem : Localizable { | ||
// "label" is a localizable member | ||
required DOMString label; | ||
required PaymentCurrencyAmount amount; | ||
boolean pending = false; | ||
}; | ||
</pre> | ||
</div> | ||
|
||
|
||
<h2 id="extensibility">Extensibility</h2> | ||
|
||
<i>This section is informative.</i> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this bit about inherited dictionaries ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Said it's one or more. Does empty string count as one or zero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. You'd have to check the bidi algorithm I'm afraid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np, checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading correctly, a paragraph is denoted by the presence of a paragraph separator. However, it says that we can also define what a paragraph means: "Paragraphs may also be determined by higher-level protocols: for example, the text in two different cells of a table will be in different paragraphs".
Like we could say that a member's value constitutes a paragraph? Dunno. Opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I quite the typedef and the flexibility it gives. Do you want to add it?
Would be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@domenic, we can probably merge
LocalizedValue
intoLocalizable
, or is there some reason to have it inherit fromLocalizable
that I'm not seeing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what Payment Request would look like if using
LocalizableString
(😍):https://github.com/w3c/browser-payment-api/pull/455/files
Also,
LocalizableString
means we can get rid of the "should" restriction, because now all localizable members now carry around their ownlang
,dir
, andvalue
🎉.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in, do I think it's a good idea? Yes. Do I want to do the work myself? Well, I will if I have to, but not this week; I was hoping you could :)
Nope, let's merge them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to!