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

Delta Between Two Patch Sets: modules/adblockplus/templates/web/static.conf.erb

Issue 29733731: #7320 - Introduce helpcenter role (Closed)
Left Patch Set: Created March 27, 2018, 3:53 a.m.
Right Patch Set: Make documentation right Created April 17, 2018, 8:03 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 | « modules/adblockplus/templates/web/hooks_wrapper.sh.erb ('k') | modules/private-stub/hiera/hosts.yaml » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Puppet: <%= @title %> 1 # Puppet: <%= @title %>
mathias 2018/03/27 14:46:52 Please don't simply copy from our legacy. There's
2 2
3 root /var/www/<%= @domain %>; 3 root /var/www/<%= @domain %>;
4 index index; 4 index index;
5 default_type text/html; 5 default_type text/html;
6 charset utf-8; 6 charset utf-8;
7 7
8 set $index_page "index"; 8 set $index_page "index";
9 9
10 <% if @custom_config %> 10 <% if @custom_config %>
11 <%= @custom_config %> 11 <%= @custom_config %>
mathias 2018/03/27 14:46:52 We know the two spaces in front of the custom conf
f.lopez 2018/03/27 19:29:50 Acknowledged.
12 <% end %> 12 <% end %>
13 13
14 location / 14 location /
15 { 15 {
16 expires 1d; 16 expires 1d;
17 17
18 # Redirect server/language root 18 # Redirect server/language root
19 19
20 rewrite ^/$ /$index_page last; 20 rewrite ^/$ /$index_page last;
21 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; 21 rewrite ^/([a-z][a-z](_[A-Z][A-Z])?)$ /$1/ permanent;
22 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; 22 rewrite ^/([a-z][a-z](_[A-Z][A-Z])?)/$ /$1/$index_page last;
23 23
24 # Match Accept-Language header against available languages 24 # Match Accept-Language header against available languages
25 25
26 set $preferredLang en; 26 set $language en;
27 set $preferredRegion ""; 27 set $region "";
mathias 2018/03/27 14:46:52 Please avoid camel case where possible, and always
f.lopez 2018/03/27 19:29:51 Acknowledged.
28 if ($http_accept_language ~ ^(\w\w)\b) 28
mathias 2018/03/27 14:46:52 An empty line in front of this block would be appr
f.lopez 2018/03/27 19:29:51 Acknowledged.
29 if ($http_accept_language ~ ^([a-z][a-z])\b)
29 { 30 {
30 set $preferredLang $1; 31 set $language $1;
31 } 32 }
32 if ($http_accept_language ~ ^\w\w-(\w\w)\b) 33 if ($http_accept_language ~ ^([a-z][a-z])-([A-Z][A-Z])\b)
33 { 34 {
34 set $preferredRegion $1; 35 set $region $1;
35 } 36 }
36 37
37 if ($arg_fb_locale ~ ^(\w\w)_(\w\w)$) 38 if ($arg_fb_locale ~ ^([a-z][a-z])_([A-Z][A-Z])$)
38 { 39 {
39 set $preferredLang $1; 40 set $language $1;
40 set $preferredRegion $2; 41 set $region $2;
41 } 42 }
42 43
43 # Redirect canonical URLs to language-specific versions 44 # Redirect canonical URLs to language-specific versions
44 45
45 if (-e "$document_root/${preferredLang}_$preferredRegion$uri") 46 if (-e "$document_root/${language}_$region$uri")
46 { 47 {
47 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; 48 rewrite ^(.*) /${language}_$region last;
48 } 49 }
49 if (-e "$document_root/$preferredLang$uri") 50 if (-e "$document_root/$language$uri")
50 { 51 {
51 rewrite ^(.*) /$preferredLang$1 last; 52 rewrite ^(.*) /$language$1 last;
52 } 53 }
53 if (-e "$document_root/en$uri") 54 if (-e "$document_root/en$uri")
54 { 55 {
55 rewrite ^(.*) /en$1 last; 56 rewrite ^(.*) /en$1 last;
56 } 57 }
57 } 58 }
58 59
59 # Redirect language URIs if no translations are found for the requested page 60 # Redirect language URIs if no translations are found for the requested page
60 61
61 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+) 62 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+)
mathias 2018/03/27 14:46:52 Why use [a-z] here but \w above? Why use [A-Z] her
f.lopez 2018/03/27 19:29:51 Not sure, gonna try it with \w, I reused what we a
f.lopez 2018/03/28 16:05:09 This is because how the translations pages are bui
62 { 63 {
63 if (!-e "$document_root$uri") 64 if (!-e "$document_root$uri")
64 { 65 {
65 # if there is no language+region translation, try parent language URI 66 # if there is no language+region translation, try parent language URI
66 # example /es_MX/page -> /es/page 67 # example /es_MX/page -> /es/page
67 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect; 68 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect;
68 } 69 }
69 } 70 }
70 71
71 location ~ ^/([a-z][a-z])(/.+) 72 location ~ ^/([a-z][a-z])(/.+)
72 { 73 {
73 if (!-e "$document_root$uri") 74 if (!-e "$document_root$uri")
74 { 75 {
75 # if there is no language translation, try canonical page for default langua ge 76 # if there is no language translation, try canonical page for default langua ge
76 # example /es/page -> /page 77 # example /es/page -> /page
77 rewrite ^/([a-z][a-z])(/.+) $2 redirect; 78 rewrite ^/([a-z][a-z])(/.+) $2 redirect;
78 } 79 }
79 } 80 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld