Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: translation-string-format.md

Issue 29422615: Issue 5068 - Define translation string format (Closed)
Left Patch Set: First draft Created April 26, 2017, 11:28 a.m.
Right Patch Set: Simplified proposed changes Created Sept. 22, 2017, 12:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Translation string format 1 # Websites translation string format
saroyanm 2017/06/01 12:07:25 I think it makes sense to define if this document
juliandoucette 2017/06/07 16:07:39 Acknowledged. I don't know how translations are d
ire 2017/06/08 11:18:34 It would be really helpful to include some example
juliandoucette 2017/06/08 21:07:51 Acknowledged.
Lisa 2017/06/09 14:14:47 Totally agree with Ire.
saroyanm 2017/06/13 09:48:27 Yes, I also agree with you. Suggestion: I think e
saroyanm 2017/06/13 09:48:27 I think strings are very similar to what we have,
2 2
3 `{{identifier[context] content }}` 3 ## Format
4 4
5 ## Brackets 5 `{{ $uid[$context] $contents }}`
saroyanm 2017/06/01 12:07:25 Suggestion: I think "required" can go right next t
juliandoucette 2017/06/07 16:07:39 Acknowledged. Good point.
6 6
7 Two curly braces must (required) go at the beginning and end of a translated str ing in Markdown and HTML format. 7 ### $uid (required)
saroyanm 2017/06/01 12:07:26 Suggestion: I think from "must" it's obvious that
juliandoucette 2017/06/07 16:07:39 Acknowledged. I guess I thought this made it more
ire 2017/06/08 11:18:34 I think, as Manvel suggested later in this doc, th
juliandoucette 2017/06/08 21:07:51 Acknowledged.
8 8
9 ## Identifier 9 Format
10 : >= 1 alphanumeric asic char
10 11
11 An identifier must (required) immediately follow two opening brackets. 12 Exceptions
13 : Should be human readable if reused.
12 14
13 - An identifier may identify only one string on one page 15 ### $context (optional - unnesisary for reuse)
saroyanm 2017/06/01 12:07:26 Word "may" sound "balanced" for me, let me know if
juliandoucette 2017/06/07 16:07:39 "may" means *can*. "should" means *preferably*. "s
saroyanm 2017/06/13 09:48:27 In this context I understand wording this way: * M
14 - If one string occurs more than once on one page in the same context, the same identifier may be used and the string context and content may be omitted
15 - An identifier may contain only lowercase latin letters and dashes
saroyanm 2017/06/01 12:07:26 Suggestion: We can make this more strong. "should"
juliandoucette 2017/06/07 16:07:38 See comment above.
saroyanm 2017/06/13 09:48:28 same as the comment above.
16 16
17 ### Identifier format 17 Format
18 : Parent HTML tag and attribute name (if applicable)
18 19
19 `summary-context-number` 20 Exceptions
21 : - Expand tag names e.g. "p" -> "paragraph"
22 - Exclude irrelivant information like heading number e.g. "h1" -> "heading"
23 - Provide functional context if applicable e.g. "title" -> "tooltip"
20 24
21 **Summary** 25 ### $content (optional - unnessisary for reuse)
22 : An identifier summary should describe the contents of the string or it’s par ent heading in as few words as possible.
saroyanm 2017/06/01 12:07:26 Note: and example here I think could make things b
juliandoucette 2017/06/07 16:07:39 Acknowledged.
Lisa 2017/06/09 14:14:47 We should include an example. Personally, I'd like
juliandoucette 2017/06/09 15:13:54 You just taught me something :)
23 26
24 **Context** 27 Format:
25 : An identifier context should describe context in which the string appears in HTML. e.g. {h: heading, p: paragraph, li: list item} 28 : >= 1 UTF-8 char
juliandoucette 2017/05/18 08:54:37 Note: We have had a policy about spelling things o
saroyanm 2017/06/01 12:07:25 I think if we agree with this approach this can be
juliandoucette 2017/06/07 16:07:39 Good point. I think there is a middle ground here.
juliandoucette 2017/06/07 16:16:18 I'm afraid this was unclear. What I mean is that t
saroyanm 2017/06/13 09:48:28 I agree with you. Would be great to come up with t
26 29
27 **Number** 30 Exceptions:
28 : A number should uniquely identify an identifier among other similar identifi ers. e.g. among multiple consecutive list items or paragraphs with the same iden tifier summary and context. 31 : Should not contain "}}"
juliandoucette 2017/05/18 08:54:37 Note: A number is not necessary if there are not m
saroyanm 2017/06/01 12:07:25 Having number "required" will minimize the effort
juliandoucette 2017/06/07 16:07:38 I agree. I found it awkward to use and/or not use
29 32
30 ## Context 33 ## Example
saroyanm 2017/06/01 12:07:25 Suggestion: Let's mark optional here rather than i
juliandoucette 2017/06/07 16:07:39 Acknowledged.
31 34
32 A Context should (optional) immediately follow an identifier. 35 ```
36 <nav>
37 <h1>{{ brand-name[heading] Adblock Plus }}</h1>
38 ...
39 </nav>
40 <header>
41 <h1>{{ brand-name }}</h1>
42 <p>{{ 1[subtitle] Blocks annoying ads }}</p>
43 </header>
44 ...
45 ```
33 46
34 - Context must be enclosed within square brackets 47 - Notice how "brand-name" is reused
35 - Context may contain upper and lower case latin letters, dashes, commas, apostr ophes, and spaces 48 - Notice how "1" has functional context
49 - Notice that "1" is a UID not an NID. It could just as easily be "a" or "9" as long as it's not used more than once on the page.
36 50
37 ### Context format 51 ## FAQ
38 52
39 A Context should (optional) describe the HTML context (e.g. heading / paragraph / list item) and meaning (e.g. “Order” as in “place an order” or “Order” as in “ Order of events”) of the string contents. 53 Why not make all string IDs human readable?
54 : Because picky humans cannot generate or review them efficiently
40 55
41 ## Content 56 Why not add location information to string contexts?
42 57 : Because [picky humans cannot generate or review them efficiently, we often be gin translation before implementation, we don't have a staging system to show vi sual context information].
43 - A string’s content must (required) be separated from its identifier and contex t by one space
44 - A string’s content should (optionally) be separated from it’s closing braces b y one space
saroyanm 2017/06/01 12:07:26 Doesn't it mean that space should also being appli
juliandoucette 2017/06/07 16:07:39 I didn't know that we could put a space before the
ire 2017/06/08 11:18:34 I also prefer the first option. But I think we sho
juliandoucette 2017/06/08 21:07:51 Acknowledged.
45 - A string must not (required) contain two closing brackets
46 - An English string should (optional) not contain non-ascii characters
47
48 ## Jinja2 format translation strings
ire 2017/06/08 11:18:34 NIT: It's a bit confusing here to start talking ab
juliandoucette 2017/06/08 21:07:51 Acknowledged.
49
50 `{{ ”content” | translate(“identifier”, “context”) }}`
51
52 Jinja2 (.tmpl) format strings are made up of the same parts (identifier, context , content) in a different format (Jinja2 filter format). The same rules apply to each part, except that the identifier and context must be surrounded by double quotes.
53
54 ## Fixed tags
55
56 `<fix>text</fix>`
57
58 Fixed tags may (optional) appear within string contents. They are meant to ident ify parts of a string that may not be translated in some languages.
59
60 - Fix tags must be closed
61 - A fix tag may be manually overriden by translations
62
63 ### Common uses
ire 2017/06/08 11:18:34 Can we have a rule on whether the company name and
juliandoucette 2017/06/08 21:07:51 Acknowledged. I guess "optional" and "common uses
ire 2017/06/09 06:50:11 Yes, you're right. I was referring to the latter t
64
65 - numbers
66 - dates
67 - names (people, brands, products)
ire 2017/06/09 06:50:11 Also, is there a rule on whether "eyeo", "Adblock
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld