- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 35
 
Add u: options namespace #846
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
  
     Merged
                    Changes from 5 commits
      Commits
    
    
            Show all changes
          
          
            12 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      0117fee
              
                Move spec/registry.md -> spec/registry/default.md
              
              
                eemeli f969ab6
              
                Add Unicode Registry definition
              
              
                eemeli 3a3d4ab
              
                Refer to BCP47, add note about only requiring normal tags
              
              
                eemeli 6c20950
              
                Merge branch 'main' into u-options
              
              
                eemeli 087bd0d
              
                Call it a namespace
              
              
                eemeli 9c307cb
              
                Apply suggestions from code review
              
              
                eemeli af2d4e9
              
                Fix test file reference
              
              
                eemeli b4b2921
              
                Apply suggestions from code review
              
              
                eemeli 680d25d
              
                Update spec/u-namespace.md
              
              
                aphillips 01fed13
              
                Apply suggestions from code review
              
              
                eemeli de56e4c
              
                Apply suggestions from code review
              
              
                eemeli 0c9414b
              
                Add mention of functions to namespace description
              
              
                eemeli 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 hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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 | 
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # MessageFormat 2.0 Unicode Namespace | ||
| 
     | 
||
| The `u:` namespace is reserved for use by the Unicode Consortium. | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| ## Options | ||
| 
     | 
||
| This section describes common **_<dfn>`u:` options</dfn>_** which each implementation SHOULD support | ||
| for all _functions_ and _markup_. | ||
| 
     | 
||
| ### `u:id` | ||
| 
     | 
||
| A string value that is included as an `id` or other suitable value | ||
| in the formatted parts for the _placeholder_, | ||
| or any other structured formatted results. | ||
| 
     | 
||
| Ignored when formatting a message to a string. | ||
| 
     | 
||
| Accepts string values, or values which can be stringified without error. | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| For other values, a _Bad Option_ error is emitted | ||
| and the `u:id` option is ignored. | ||
| 
     | 
||
| ### `u:locale` | ||
| 
     | 
||
| A comma-delimited list of BCP 47 language tags, | ||
| or an implementation-defined list of such tags. | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| Replaces the _locale_ defined in the _function context_ for this _expression_. | ||
                
      
                  aphillips marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| The value is ignored when set on _markup_. | ||
| 
     | 
||
| During processing, the `u:locale` option | ||
| is always removed from the resolved mapping of _options_. | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| Values matching the following ABNF are always accepted: | ||
| ```abnf | ||
| u-locale-option = langtag *([s] "," [s] langtag) | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| ``` | ||
| using `langtag` as defined in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). | ||
| Note that `langtag` is the rule for "normal language tags", | ||
| and does not include private-use or grandfathered tags. | ||
| 
     | 
||
| Implementations MAY support additional language tags, | ||
| such as private-use or grandfathered tags, | ||
| or tags using `_` instead of `-` as a separator. | ||
| When the value of `u:locale` is set by a _variable_, | ||
| implementations MAY support non-string values otherwise representing locales. | ||
| 
     | 
||
| For unsupported values, a _Bad Option_ error is emitted | ||
| and the value of the `u:locale` option is ignored. | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| ### `u:dir` | ||
| 
     | 
||
| Replaces the base directionality defined in | ||
| the _function context_ for this _expression_. | ||
| The value is ignored when set on _markup_. | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| During processing, the `u:dir` option | ||
| is always removed from the resolved mapping of _options_. | ||
| 
     | 
||
| Accepts the following string values: | ||
| - `ltr`: left-to-right directionality | ||
| - `rtl`: right-to-left directionality | ||
| - `auto`: directionality determined from _expression_ contents | ||
                
      
                  eemeli marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| For other values, a _Bad Option_ error is emitted | ||
| and the value of the `u:dir` option is ignored. | ||
  
    
      This file contains hidden or 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
    
  
  
    
              
  
    
      This file contains hidden or 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 | 
|---|---|---|
| 
          
            
          
           | 
    @@ -269,6 +269,9 @@ | |
| "name": { | ||
| "type": "string" | ||
| }, | ||
| "id": { | ||
| "type": "string" | ||
| }, | ||
| "options": { | ||
| "type": "object" | ||
| } | ||
| 
          
            
          
           | 
    ||
  
    
      This file contains hidden or 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 | 
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| { | ||
| "$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json", | ||
| "scenario": "u: Options", | ||
| "description": "Common options affecting the function context", | ||
| "defaultTestProperties": { | ||
| "locale": "en-US" | ||
| }, | ||
| "tests": [ | ||
| { | ||
| "src": "{#tag u:id=x u:dir=rtl u:locale=ar}content{/ns:tag u:id=x}", | ||
| "exp": "content", | ||
| "expParts": [ | ||
| { | ||
| "type": "markup", | ||
| "kind": "open", | ||
| "id": "x", | ||
| "name": "tag" | ||
| }, | ||
| { | ||
| "type": "literal", | ||
| "value": "content" | ||
| }, | ||
| { | ||
| "type": "markup", | ||
| "kind": "close", | ||
| "id": "x", | ||
| "name": "tag" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "src": "hello {4.2 :number u:locale=fr}", | ||
| "exp": "hello 4,2" | ||
| }, | ||
| { | ||
| "src": "hello {world :string u:dir=ltr u:id=foo}", | ||
| "exp": "hello world", | ||
| "expParts": [ | ||
| { | ||
| "type": "literal", | ||
| "value": "hello " | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "source": "|world|", | ||
| "dir": "ltr", | ||
| "id": "foo", | ||
| "value": "world" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "src": "hello {world :string u:dir=rtl}", | ||
| "exp": "hello \u2067world\u2069", | ||
| "expParts": [ | ||
| { | ||
| "type": "literal", | ||
| "value": "hello " | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "source": "|world|", | ||
| "dir": "rtl", | ||
| "value": "world" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "src": "hello {world :string u:dir=auto}", | ||
| "exp": "hello \u2068world\u2069", | ||
| "expParts": [ | ||
| { | ||
| "type": "literal", | ||
| "value": "hello " | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "source": "|world|", | ||
| "dir": "auto", | ||
| "value": "world" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "locale": "ar", | ||
| "src": "أهلاً {بالعالم :string u:dir=rtl}", | ||
| "exp": "أهلاً \u2067بالعالم\u2069" | ||
| }, | ||
| { | ||
| "locale": "ar", | ||
| "src": "أهلاً {بالعالم :string u:dir=auto}", | ||
| "exp": "أهلاً \u2068بالعالم\u2069" | ||
| }, | ||
| { | ||
| "locale": "ar", | ||
| "src": "أهلاً {world :string u:dir=ltr}", | ||
| "exp": "أهلاً \u2066world\u2069" | ||
| }, | ||
| { | ||
| "locale": "ar", | ||
| "src": "أهلاً {بالعالم :string}", | ||
| "exp": "أهلاً \u2067بالعالم\u2069" | ||
| } | ||
| ] | ||
| } | 
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.