-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtranslate_docs.py
More file actions
1508 lines (1406 loc) · 50.1 KB
/
translate_docs.py
File metadata and controls
1508 lines (1406 loc) · 50.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import os
from pathlib import Path
import re
import sys
import argostranslate.package
import argostranslate.translate
# NOTES These are machine translations, and so are inherently imperfect. The use of ERDDAP and
# domain-related jargon makes it even harder. Most of the translated text hasn't even be
# read/proofed by a human.
from_code = "en"
# Download and install Argos Translate package
argostranslate.package.update_package_index()
available_packages = argostranslate.package.get_available_packages()
markdown_formatting_line_start = [
"# ",
"## ",
"### ",
"#### ",
"##### ",
"###### ",
]
markdown_formatting_preserve_preceding_whitespace = [
"* ",
"- ",
# also number.
]
language_code_list = [
# "en", # Don't do en->en translation
"bn",
"zh", # was "zh-CN"
"zt", # was "zh-TW"
"cs",
"da",
"nl",
"fi",
"fr",
"de",
"el",
#"gu", # not supported in argos
"hi",
"hu",
"id",
"ga",
"it",
"ja",
"ko",
#"mr", # not supported in argos
"nb", # was "no"
"pl",
"pt",
#"pa", # not supported in argos
"ro",
"ru",
"es",
#"sw", # not supported in argos
"sv",
"tl",
"th",
"tr",
"uk",
"ur",
#"vi" # not supported in argos
]
dont_translate_strings = [
# !!!ESSENTIAL: if a short phrase (DAP) is in a long phrase (ERDDAP), the long phrase must come
# first.
# main() below has a test for this.
# phrases in quotes
"\" since \"",
"\"&units=...\"",
"\"&C;\"",
"\"µ\"", # otherwise it is often dropped from the translation. Only used in one place
# in messages.xml.
"\"BLANK\"",
"\"c/s\"",
"\"CA, Monterey\"",
"\"Cel\"",
"\"Coastlines\"",
"\"comment\"",
"\"content-encoding\"",
"\"count\"",
"\"days since Jan 1, 1900\"",
"\"deg\"",
"\"degree\"",
"\"degree_north\"",
"\"extended\"",
"\"farad\"",
"\"files\"",
"\"gram\"",
"\"hours since 0001-01-01\"",
"\"import\"",
"\"institution\"",
"\"J\"",
"\"joule\"",
"\"joules\"",
"\"kg.m2.s-2\"",
"\"kilo\"",
"\"LakesAndRivers\"",
"\"Land\"",
"\"last\"",
"\"Linear\"",
"\"Log\"",
"\"log\"",
"\"long_name\"",
"\"m s-1\"",
"\"m.s^-1\"",
"\"meter per second\"",
"\"meters/second\"",
"\"mo_g\"",
"\"months since 1970-01-01\"",
"\"months since\"",
"\"Nations\"",
"\"per\"",
"\"PER\"",
"\"Range\"",
"\"Sea Surface Temperature\"",
"\"searchFor=wind%20speed\"",
"\"seconds since\"",
"\"seconds since 1970-01-01\"",
"\"seconds since 1970-01-01T00:00:00Z\"",
"\"since\"",
"\"SOS\"",
"\"sos\"",
"\"sst\"",
"\"States\"",
"\"stationID,time/1day,10\"",
"\"time\"",
"\"times\"",
"\"times 1000\"",
"\"title\"",
"\"years since\"",
"'u'",
"'/'",
"'*'",
"'^'",
"'='",
# <kbd> was here
# All psuedo entities (used for param names, proper nouns, substitutions)
# MUST be here by themselves
# OR in <kbd>&pseudoEntity;</kbd> above
# so code in postProcessHtml works correctly.
# postProcessHtml() REQUIRES that "pseudoEntity" only use [a-zA-Z0-9].
"&acceptEncodingHtml;",
"&acceptEncodingHtmlh3tErddapUrl;",
"&adminContact;",
"&advancedSearch;",
"&algorithm;",
"&bgcolor;",
"&BroughtToYouBy;",
"&C;",
# above is <kbd>&category;</kbd>
"&convertTimeReference;",
"&cookiesHelp;",
"&dataFileTypeInfo1;",
"&dataFileTypeInfo2;",
"&descriptionUrl;",
"&datasetListRef;",
"&e0;",
"&EasierAccessToScientificData;",
"&elevation;",
"&encodedDefaultPIppQuery;",
"&erddapIs;",
"&erddapUrl;",
"&erddapVersion;",
"&exceptions;",
"&externalLinkHtml;",
"&F;",
"&FALSE;",
"&format;",
"&fromInfo;",
"&g;",
"&griddapExample;",
"&headingType;",
"&height;",
"&htmlQueryUrl;",
"&htmlQueryUrlWithSpaces;",
"&htmlTooltipImage;",
"&info;",
"&initialHelp;",
"&jsonQueryUrl;",
"&langCode;",
"&language;",
"&layers;",
"&license;",
"&likeThis;",
"&loginInfo;",
# these <tag>s were gathered by code in main that matches a regex in messages.xml
"&makeAGraphListRef;",
"&makeAGraphRef;",
" ",
"&niceProtocol;",
"&NTU;",
"&offerValidMinutes;",
"&partNumberA;",
"&partNumberB;",
"&plainLinkExamples1;",
"&plainLinkExamples2;",
"&plainLinkExamples3;",
"&plainLinkExamples4;",
"&plainLinkExamples5;",
"&plainLinkExamples6;",
"&plainLinkExamples7;",
"&plainLinkExamples8;",
"&protocolName;",
"&PSU;",
"&requestFormatExamplesHtml;",
"&requestGetCapabilities;",
"&requestGetMap;",
"&resultsFormatExamplesHtml;",
# above is <kbd>&safeEmail;</kbd>
"&sampleUrl;",
"&secondPart;",
# above is <kbd>&searchButton;</kbd>
"&serviceWMS;",
"&sheadingType;",
"&ssUse;",
"&standardLicense;",
"&styles;",
"&subListUrl;",
"&tabledapExample;",
"&tagline;",
"&tEmailAddress;",
"&tErddapUrl;",
"&time;",
"&transparentTRUEFALSE;",
"&TRUE;",
"&tTimestamp;",
"&tWmsGetCapabilities130;",
"&tWmsOpaqueExample130Replaced;",
"&tWmsOpaqueExample130;",
"&tWmsTransparentExample130Replaced;",
"&tWmsTransparentExample130;",
"&tYourName;",
"&unitsStandard;",
"&variable;",
"&version;",
"&versionLink;",
"&versionResponse;",
"&versionStringLink;",
"&versionStringResponse;",
"&widgetEmailAddress;",
"&widgetFrequencyOptions;",
"&widgetGriddedOptions;",
"&widgetSelectGroup;",
"&widgetSubmitButton;",
"&widgetTabularOptions;",
"&widgetYourName;",
"&width;",
"&wmsVersion;",
"&wmsManyDatasets;",
"&WMSSEPARATOR;",
"&WMSSERVER;",
# things that are never translated
"@noaa.gov",
".bz2",
".fileType",
".gzip",
".gz",
".hdf",
".htmlTable",
".itx",
".jsonlCSV1",
".jsonlCSV", # must be after the .jsonlCSV1
".jsonlKVP",
".json", # must be after the longer versions
".kml",
".mat",
".nccsv",
".nc", # must be after .nccsv
".tar",
".tgz",
".tsv",
".xhtml",
".zip",
".z",
# text (proper nouns, parameter names, phrases, etc) that shouldn't be translated
"1230768000 seconds since 1970-01-01T00:00:00Z",
"2452952 \"days since -4712-01-01\"",
"2009-01-21T23:00:00Z",
"60000=AS=AMERICA SAMOA",
"64000=FM=FEDERATED STATES OF MICRONESIA",
"66000=GU=GUAM",
"68000=MH=MARSHALL ISLANDS",
"69000=MP=NORTHERN MARIANA ISLANDS",
"70000=PW=PALAU",
"72000=PR=PUERTO RICO",
"74000=UM=U.S. MINOR OUTLYING ISLANDS",
"78000=VI=VIRGIN ISLANDS OF THE UNITED STATES",
"actual\_range",
"addAttributes",
"add\_offset",
"ADD \_FillValue ATTRIBUTES",
"AJAX",
"algorithm=Nearest",
"algorithms for oligotrophic oceans: A novel approach",
"allDatasets",
"ArcGIS for Server",
"ArcGIS",
"Ardour",
"Audacity",
"Awesome ERDDAP",
"axisVariable",
"based on three-band reflectance difference, J. Geophys.",
"beginTime",
"bob dot simons at noaa dot gov",
"bob.simons at noaa.gov",
"categoryAttributes",
"centeredTime",
"COARDS",
"colorBarMaximum",
"colorBarMinimum",
"Conda",
"content-encoding",
"contributor\_name",
"contributor\_role",
"coverage\_content\_type",
"creator\_name",
"creator\_email",
"creator\_url",
"curl",
# "DAP", is below, after OPeNDAP
"d, day, days,",
"datasetID/variable/algorithm/nearby", # before datasetID
"datasetID",
"datasets.xml",
"dataVariable",
"data\_max",
"data\_min",
"date\_created",
"date\_modified",
"date\_issued",
"Davis, J.C. 1986. Statistics and Data Analysis in Geology, 2nd Ed. John Wiley and Sons. New York, New York.",
"days since 2010-01-01",
"deflate",
"degree_C",
"degree_F",
"degrees_east",
"degrees_north",
"destinationName",
"DODS",
"DOI",
"drawLandMask",
"Earth Science & Atmosphere & Atmospheric Pressure & Atmospheric Pressure Measurements",
"Earth Science & Atmosphere & Atmospheric Pressure & Sea Level Pressure",
"Earth Science & Atmosphere & Atmospheric Pressure & Static Pressure",
"EDDGrid",
"endTime",
"ERDDAP™",
"erddapContentDirectory",
"featureType",
"=~tomcat/content/erddap",
"_tomcat_/content/erddap",
"_tomcat_\\bin\\startup.bat",
"_tomcat_\\bin\\setenv.bat",
"/erddap/outOfDateDatasets.html",
"outOfDateDatasets.html",
"/erddap/status.html",
"ERDDAP", # before ERD and DAP
"erd dot data at noaa dot gov",
"erd.data at noaa.gov",
"ERD",
"ESPRESSO",
"ESPreSSO",
"ESRI .asc",
"ESRI GeoServices REST",
"excludedWord",
"Ferret",
"FileInfo.com",
"FIPS",
"GetCapabilities",
"GetMap",
"Gimp",
"GNOME",
"Google Charts",
"Google Earth",
"Google Visualization",
# "gzip", #is below after x-gzip
"h, hr, hrs, hour, hours,",
"HDF",
# "http://127.0.0.1:8080",
# "https://coastwatch.pfeg.noaa.gov/erddap/files/jplMURSST41/.csv",
# "https://coastwatch.pfeg.noaa.gov/erddap/files/jplMURSST41/",
# "https://coastwatch.pfeg.noaa.gov/erddap/info/cwwcNDBCMet/index.html",
# "https://coastwatch.pfeg.noaa.gov/erddap/tabledap/cwwcNDBCMet.nccsvMetadata",
# "https://coastwatch.pfeg.noaa.gov/erddap/griddap/jplAquariusSSS3MonthV5.html",
# "https://coastwatch.pfeg.noaa.gov/erddap/index.html",
# "https://coastwatch.pfeg.noaa.gov",
# "https://oceanwatch.pfeg.noaa.gov/thredds/catalog/catalog.xml",
# "https://oceanwatch.pfeg.noaa.gov/thredds/catalog/Satellite/aggregsatMH/chla/catalog.xml",
# "https://oceanwatch.pfeg.noaa.gov/thredds/Satellite/aggregsatMH/chla/catalog.html",
# "https://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/BA/ssta/5day",
# "https://oceanwatch.pfeg.noaa.gov",
"HTTP GET",
"Hyrax",
"InverseDistance",
"IOOS DIF SOS",
"IOOS Animal Telemetry Network",
"ioos\_category",
"infoUrl",
"IrfanView",
"Java",
"java.net.URLEncoder",
"keywords\_vocabulary",
"KT\_",
"Leaflet",
"long\_name",
"long_name",
"m, min, mins, minute, minutes,",
"mashups",
"Matlab",
"maximum=37.0",
"minimum=32.0",
"missing\_value",
"Metadata\_Conventions",
"mon, mons, month, months,",
"ms, msec, msecs, millis, millisecond, milliseconds,",
"NASA's Panoply",
"National Oceanic and Atmospheric Administration",
"NCO",
"Ncview",
"Nearest, Bilinear, Scaled",
"NetCDF",
"NMFS",
"NOAA",
"now-7days", # before now-
"now-",
"ODV .txt",
"OGC",
"OOSTethys",
"OPeNDAP",
"DAP", # out of place, so that it is after ERDDAP and OPeNDAP
"OpenID",
"OpenLayers",
"OpenSearch",
"Oracle",
"orderByClosest",
"orderByCount",
"orderByLimit",
"orderByMax",
"orderByMean",
"orderByMinMax",
"orderBy", # must be after the longer versions
"Panoply",
"Photoshop",
"Practical Salinity Units",
"processing\_level",
"protocol=griddap",
"protocol=tabledap",
"PSU",
"publisher\_name",
"publisher\_email",
"publisher\_url",
"Pull",
"Push",
"Python",
"real\_time",
"Res., 117, C01011, doi:10.1029/2011JC007395.",
"RESTful", # before REST
"REST",
"ROA",
"RSS",
"s, sec, secs, second, seconds,",
"Satellite Application Facility",
"scale\_factor",
"Sea Surface Temperature",
"searchEngine=lucene",
"shutdown.bat",
"SOAP+XML",
"SOS",
"sourceName",
"sourceUrl",
"sst",
"standard\_name\_vocabulary",
"standard\_name",
"stationID",
"StickX",
"StickY",
"subsetVariables",
"Surface Skin Temperature",
"SWFSC", # before WFS
"Synthetic Aperture Focusing",
"tabledap",
"testOutOfDate",
"time\_precision",
"time\_zone",
"Todd",
"uDig",
"UDUNITS",
"Unidata",
"URN",
"valid\_max",
"valid\_min",
"valid\_range",
"WCS",
"week, weeks,",
"WFS",
"wget",
"Wikipedia",
"WMS",
"x-gzip",
"gzip", # must be after x-gzip
"yr, yrs, year, or years",
"yyyy-MM-ddTHH:mm:ssZ", # before yyyy-MM-dd
"yyyy-MM-dd",
"Zulu",
"\*.sh",
"\\\\uhhh",
"\\uhhhh",
"\\\\u*hhhh*",
"\\u*hhhh*",
"uhhhh",
"\\\\r\\\\n",
"\\\\n",
"\\r\\n",
"\\n",
"\r\n",
"\\[",
"\\]",
"\[",
"\]",
"http://",
"https://",
"https:",
"https",
"http",
"httpGetRequiredVariables",
"\\d{7}",
"\\\\uffff",
"\\uffff",
"\\\\u0000",
"\\u0000"
"=",
"|", # Used to define tables, needs to be kept as |
]
pre_matcher_dont_translate_strings = [
"S(\\d{7})\\d{7}\\.L3b.\*",
"S(\\\\d{7})\\\\d{7}\\\\.L3b.\\\*",
"\"{0}\"",
"\"{1}\"",
"\"{count}\"",
"\"\\*\\*\"",
"\"[in_i]\"",
"\"[todd'U]\"",
"\"%{vol}\"",
"\"deg{north}\"",
"\"s{since 1970-01-01T00:00:00Z}\"",
# lots of things that shouldn't be translated are within <kbd> and <strong>
"<kbd>\"long_name=Sea Surface Temperature\"</kbd>",
"<kbd>{0} : {1}</kbd>",
"<kbd>{0}</kbd>",
"<kbd>{1} : {2}</kbd>",
"<kbd>{41008,41009,41010}</kbd>",
"<kbd>#1</kbd>",
# there are some <kbd>&pseudoEntity;</kbd> The translation system REQUIRES that "pseudoEntity"
# only use [a-zA-Z0-9].
"<kbd>&adminEmail;</kbd>",
"<kbd>&addVariablesWhere(\"<i>attName</i>\",\"<i>attValue</i>\")</kbd>",
"<kbd>&</kbd>",
"<kbd>&stationID%3E=%2241004%22</kbd>",
"<kbd>&stationID>=\"41004\"</kbd>",
"<kbd>&time>now-7days</kbd>",
"<kbd>&units(\"UDUNITS\")</kbd>",
"<kbd>&units(\"UCUM\")</kbd>",
"<kbd>&category;</kbd>",
"<kbd><att name=\"units\">days since -4712-01-01T00:00:00Z</att></kbd>",
"<kbd><units_standard></kbd>",
"<kbd>"wind speed"</kbd>",
"<kbd>"datasetID=<i>erd</i>"</kbd>",
"<kbd>&safeEmail;</kbd>",
"<kbd>&searchButton;</kbd>",
"<kbd>(last)</kbd>",
"<kbd>(unknown)</kbd>",
"<kbd>--compressed</kbd>",
"<kbd>-999</kbd>",
"<kbd>-g</kbd>",
"<kbd>-o <i>fileDir/fileName.ext</i></kbd>",
"<kbd>-<i>excludedWord</i></kbd>",
"<kbd>-"<i>excluded phrase</i>"</kbd>",
"<kbd>01</kbd>",
"<kbd>2014</kbd>",
"<kbd>2020-06-12T06:17:00Z</kbd>",
"<kbd><i>attName</i>=<i>attValue</i></kbd>",
"<kbd><i>attName=attValue</i></kbd>",
"<kbd><i>erddapUrl</i></kbd>",
"<kbd><i>units</i> since <i>basetime</i></kbd>",
"<kbd>air_pressure</kbd>",
"<kbd>algorithm</kbd>",
"<kbd>altitude</kbd>",
"<kbd>attribute=value</kbd>",
"<kbd>AND</kbd>",
"<kbd>Back</kbd>",
"<kbd>Bilinear</kbd>",
"<kbd>Bilinear/4</kbd>",
"<kbd>bob dot simons at noaa dot gov</kbd>",
"<kbd>boolean</kbd>",
"<kbd>Bypass this form</kbd>",
"<kbd>byte</kbd>",
"<kbd>Cel</kbd>",
"<kbd>CMC0.2deg-CMC-L4-GLOB-v2.0</kbd>",
"<kbd>cmd</kbd>",
"<kbd>count</kbd>",
"<kbd>curl --compressed \"<i>erddapUrl</i>\" -o <i>fileDir/fileName#1.ext</i></kbd>",
"<kbd>curl --compressed -g \"<i>erddapUrl</i>\" -o <i>fileDir/fileName.ext</i></kbd>",
"<kbd>datasetID</kbd>",
"<kbd>datasetID/variable/algorithm/nearby</kbd>",
"<kbd>days since 2010-01-01</kbd>",
"<kbd>deflate</kbd>",
"<kbd>degC</kbd>",
"<kbd>degF</kbd>",
"<kbd>degK</kbd>",
"<kbd>degree_C</kbd>",
"<kbd>degree_F</kbd>",
"<kbd>degrees_east</kbd>",
"<kbd>degrees_north</kbd>",
"<kbd>depth</kbd>",
"<kbd>double</kbd>",
"<kbd>File : Open</kbd>",
"<kbd>File : Save As</kbd>",
"<kbd>File Type</kbd>",
"<kbd>File type</kbd>",
"<kbd>float</kbd>",
"<kbd>fullName=National Oceanic and Atmospheric Administration</kbd>",
"<kbd>fullName=National%20Oceanic%20and%20Atmospheric%20Administration</kbd>",
"<kbd>graph</kbd>",
"<kbd>Graph Type</kbd>",
"<kbd>Grid</kbd>",
"<kbd>HTTP 404 Not-Found</kbd>",
"<kbd>https://spray.ucsd.edu</kbd>",
"<kbd>https://www.yourWebSite.com?department=R%26D&action=rerunTheModel</kbd>",
"<kbd>Identifier</kbd>",
"<kbd>In 8x</kbd>",
"<kbd>InverseDistance2</kbd>",
"<kbd>InverseDistance4</kbd>",
"<kbd>InverseDistance6</kbd>",
"<kbd>InverseDistance</kbd>",
"<kbd>int</kbd>",
"<kbd>John Smith</kbd>",
"<kbd>jplMURSST41/analysed_sst/Bilinear/4</kbd>",
"<kbd>jplMURSST41_analysed_sst_Bilinear_4</kbd>",
"<kbd>Just generate the URL</kbd>",
"<kbd>keywords</kbd>",
"<kbd>last</kbd>",
# "<kbd>(last)</kbd>" is above
"<kbd>latitude</kbd>",
"<kbd>Location</kbd>",
"<kbd>long</kbd>",
"<kbd>longitude</kbd>",
"<kbd>maximum=37.0</kbd>",
"<kbd>mean</kbd>",
"<kbd>Mean</kbd>",
"<kbd>Median</kbd>",
"<kbd>minimum=32.0</kbd>",
"<kbd>NaN</kbd>",
"<kbd>nearby</kbd>",
"<kbd>Nearest</kbd>",
"<kbd>No animals were harmed during the collection of this data.</kbd>",
"<kbd>NOAA NMFS SWFSC</kbd>",
"<kbd>now-7days</kbd>",
"<kbd>Ocean Color</kbd>",
"<kbd>org.ghrsst</kbd>",
"<kbd>Other</kbd>",
"<kbd>Point</kbd>",
"<kbd>Profile</kbd>",
"<kbd>protocol=griddap</kbd>",
"<kbd>protocol=tabledap</kbd>",
"<kbd>Redraw the Graph</kbd>",
"<kbd>Refine ...</kbd>",
"<kbd>Scaled</kbd>",
"<kbd>SD</kbd>",
"<kbd>sea_water_temperature</kbd>",
"<kbd>short</kbd>",
"<kbd>Simons, R.A. 2022. ERDDAP. https://coastwatch.pfeg.noaa.gov/erddap . Monterey, CA: NOAA/NMFS/SWFSC/ERD.</kbd>",
"<kbd>spee</kbd>",
"<kbd>speed</kbd>",
"<kbd>Spray Gliders, Scripps Institution of Oceanography</kbd>",
"<kbd>[standard]</kbd>",
"<kbd>STANDARDIZE_UDUNITS=<i>udunitsString</i></kbd>",
"<kbd>Start:Stop</kbd>",
"<kbd>Start:Stride:Stop</kbd>",
"<kbd>Start</kbd>",
"<kbd>Stop</kbd>",
"<kbd>Stride</kbd>",
"<kbd>String</kbd>",
"<kbd>Submit</kbd>",
"<kbd>Subset</kbd>",
"<kbd>Taxonomy</kbd>",
"<kbd>testOutOfDate</kbd>",
"<kbd>text=<i>some%20percent-encoded%20text</i></kbd>",
"<kbd>Time</kbd>",
"<kbd>time</kbd>",
"<kbd>time>now-2days</kbd>",
"<kbd>time>max(time)-2days</kbd>",
"<kbd>timestamp</kbd>",
"<kbd>TimeSeries</kbd>",
"<kbd>TimeSeriesProfile</kbd>",
"<kbd>title=Spray Gliders, Scripps Institution of Oceanography</kbd>",
"<kbd>Trajectory</kbd>",
"<kbd>TrajectoryProfile</kbd>",
"<kbd>true</kbd>",
"<kbd>UCUM=<i>ucumString</i></kbd>",
"<kbd>units=degree_C</kbd>",
# "<kbd><i>units</i> since <i>basetime</i></kbd>" is above
"<kbd>Unknown</kbd>",
"<kbd>URL/action</kbd>",
"<kbd>variable</kbd>",
"<kbd>view the URL</kbd>",
"<kbd>Water Temperature</kbd>",
"<kbd>waterTemp</kbd>",
"<kbd>WindSpeed</kbd>",
"<kbd>wt</kbd>",
"<kbd>your.name@yourOrganization.org</kbd>",
"<kbd>yyyy-MM-ddTHH:mm:ssZ</kbd>",
"<pre>curl --compressed -g \"https://coastwatch.pfeg.noaa.gov/erddap/files/cwwcNDBCMet/nrt/NDBC_41008_met.nc\" -o ndbc/41008.nc</pre>",
"<pre>curl --compressed \"https://coastwatch.pfeg.noaa.gov/erddap/files/cwwcNDBCMet/nrt/NDBC_{41008,41009,41010}_met.nc\" -o ndbc/#1.nc</pre>",
"</att>",
"<addAttributes>",
"<subsetVariables>",
"<time_precision>",
"<units_standard>",
"<updateUrls>",
"<",
"{ }",
"{east}",
"{north}",
"{NTU}",
"{PSU}",
"{true}",
"{west}",
"( )",
"(Davis, 1986, eq 5.67, page 367)",
"(Nephelometric Turbidity Unit)",
"(OPeN)DAP",
"(Practical Salinity Units)",
"[ ]",
"[standardContact]",
"[standardDataLicenses]",
"[standardDisclaimerOfEndorsement]",
"[standardDisclaimerOfExternalLinks]",
"[standardPrivacyPolicy]",
"[standardShortDescriptionHtml]",
"C., Lee Z., and Franz, B.A. (2012). Chlorophyll-a",
"Chronological Julian Dates (CJD)",
"E = ∑(w Y)/∑(w)",
"encodeURIComponent()",
"fileType={0}",
"http<strong>s</strong>",
"position={1}",
"orderBy(\"stationID, time\")", # before orderBy
"orderByClosest(\"stationID, time/2hours\")",
"orderByCount(\"stationID, time/1day\")",
"orderByMax(\"stationID, time/1day\")",
"orderByMax(\"stationID, time/1day, 10\")",
"orderByMax(\"stationID, time/1day, temperature\")",
"orderByMinMax(\"stationID, time/1day, temperature\")",
"<strong>lines</strong>",
"<strong>linesAndMarkers</strong>",
"<strong>markers</strong>",
"<strong>sticks</strong>",
"<strong>surface</strong>",
"<strong>vectors</strong>",
]
# For testing
# language_code_list = [
# "es",
# ]
def get_file_name(file_path):
file_path_components = file_path.split('/')
return file_path_components[-1]
def get_docs_file_path(file_path):
path = Path(file_path)
if path.parent.name == "docs":
return path.name
else:
return os.path.join(path.parent.name, path.name)
def get_json_path(file_path):
path = Path(file_path)
if path.parent.name == "en":
return path.name
else:
return os.path.join(path.parent.name, path.name)
def find_files(src_filepath, extension, filter_filepaths):
filepath_list = []
#This for loop uses the os.walk() function to walk through the files and directories
#and records the filepaths of the files to a list
for root, dirs, files in os.walk(src_filepath):
#iterate through the files currently obtained by os.walk() and
#create the filepath string for that file and add it to the filepath_list list
for file in files:
#Checks to see if the root is '.' and changes it to the correct current
#working directory by calling os.getcwd(). Otherwise root_path will just be the root variable value.
if root == '.':
root_path = os.getcwd() + "/"
else:
root_path = root
filepath = root_path + "/" + file
#If filter_filepaths is not empty, remove any filepaths not contained in the filter list
if filter_filepaths and filepath not in filter_filepaths:
continue
#Appends filepath to filepath_list if filepath does not currently exist in filepath_list
# Also don't include auto generated documentation (dokka)
if filepath not in filepath_list and filepath.endswith(extension) and not "dokka" in filepath:
filepath_list.append(filepath)
#Return filepath_list
return filepath_list
def find_and_install_langauge_package(target):
package_to_install = next(
filter(
lambda x: x.from_code == from_code and x.to_code == target, available_packages
)
)
argostranslate.package.install_from_path(package_to_install.download())
class ImageMatcher:
def getMatch(self, chunk):
self.match = re.search(r"[!]\[(.*?)\]\((.*?)\)", chunk)
def getStart(self):
if self.match:
return self.match.start()
else:
return -1
def getEnd(self):
if self.match:
return self.match.end()
else:
return -1
def processMatch(self, processed_line, idx, chunk):
# before link text
processed_line["translate_text"][idx] = chunk[:self.match.start()]
# link text
processed_line["translate_text"].append(self.match.group(1))
# text after the link
processed_line["translate_text"].append(chunk[self.match.end():])
# update format {idx} -> {idx} + "[" +"{legnth-2}" +"]" + "(" + match.group(2) + ")" + "{length-1}"
placeholder = "{"+ str(idx) +"}"
processed_line["format"] = processed_line["format"].replace(placeholder, placeholder + "![{" + str(len(processed_line["translate_text"]) -2) + "}](" + self.match.group(2) + "){" + str(len(processed_line["translate_text"]) -1) + "}")
return processed_line
class LinkMatcher:
def getMatch(self, chunk):
self.match = re.search(r"\[((?:[^][]|\[[^]]*\])*)]\(([^)]*?)\)", chunk)
def getStart(self):
if self.match:
return self.match.start()
else:
return -1
def getEnd(self):
if self.match:
return self.match.end()
else:
return -1
def processMatch(self, processed_line, idx, chunk):
# before link text
processed_line["translate_text"][idx] = chunk[:self.match.start()]
# link text
processed_line["translate_text"].append(self.match.group(1))
# text after the link
processed_line["translate_text"].append(chunk[self.match.end():])
# update format {idx} -> {idx} + "[" +"{legnth-2}" +"]" + "(" + match.group(2) + ")" + "{length-1}"
placeholder = "{"+ str(idx) +"}"
processed_line["format"] = processed_line["format"].replace(placeholder, placeholder + " [{" + str(len(processed_line["translate_text"]) -2) + "}](" + self.match.group(2) + ") {" + str(len(processed_line["translate_text"]) -1) + "}")
return processed_line
class TagMatcher:
def getMatch(self, chunk):
self.match = re.search(r"<(.*?)>", chunk)
def getStart(self):
if self.match:
return self.match.start()
else:
return -1
def getEnd(self):
if self.match:
return self.match.end()
else:
return -1
def processMatch(self, processed_line, idx, chunk):
# before tag text
processed_line["translate_text"][idx] = chunk[:self.match.start()]
# text after the tag
processed_line["translate_text"].append(chunk[self.match.end():])
# update format {idx} -> {idx} + "<" + match.group(0) + ">" + "{length-1}"
placeholder = "{"+ str(idx) +"}"
processed_line["format"] = processed_line["format"].replace(placeholder, placeholder + " " + self.match.group(0) + " {" + str(len(processed_line["translate_text"]) -1) + "}")
return processed_line
class EscapedTagMatcher:
def getMatch(self, chunk):
self.match = re.search(r"\<\;(.*?)\>\;", chunk)
def getStart(self):
if self.match:
return self.match.start()
else:
return -1
def getEnd(self):
if self.match:
return self.match.end()
else:
return -1
def processMatch(self, processed_line, idx, chunk):
# before tag text
processed_line["translate_text"][idx] = chunk[:self.match.start()]
# text after the tag
processed_line["translate_text"].append(chunk[self.match.end():])
# update format {idx} -> {idx} + "<" + match.group(0) + ">" + "{length-1}"
placeholder = "{"+ str(idx) +"}"
processed_line["format"] = processed_line["format"].replace(placeholder, placeholder + " " + self.match.group(0) + "{" + str(len(processed_line["translate_text"]) -1) + "}")
return processed_line
class StarEmphasisMatcher:
def getMatch(self, chunk):
self.match = re.search(r"\\\*(.*?)\\\*", chunk)
def getStart(self):
if self.match:
return self.match.start()
else:
return -1
def getEnd(self):
if self.match:
return self.match.end()
else:
return -1
def processMatch(self, processed_line, idx, chunk):
# before tag text
processed_line["translate_text"][idx] = chunk[:self.match.start()]
# The match text
processed_line["translate_text"].append(self.match.group(1))
# text after the tag
processed_line["translate_text"].append(chunk[self.match.end():])
# update format {idx} -> {idx} + "*" + {length-1} + "*" + "{length-2}"
placeholder = "{"+ str(idx) +"}"
processed_line["format"] = processed_line["format"].replace(placeholder, placeholder + "\\*" + "{" + str(len(processed_line["translate_text"]) -2) + "}\\*{" + str(len(processed_line["translate_text"]) -1) + "}")
return processed_line
class BoldMatcher:
def getMatch(self, chunk):
self.match = re.search(r"\*\*(.*?)\*\*", chunk)
def getStart(self):
if self.match:
return self.match.start()
else:
return -1
def getEnd(self):
if self.match:
return self.match.end()
else:
return -1
def processMatch(self, processed_line, idx, chunk):
# before tag text
processed_line["translate_text"][idx] = chunk[:self.match.start()]
# The match text
processed_line["translate_text"].append(self.match.group(1))
# text after the tag
processed_line["translate_text"].append(chunk[self.match.end():])
# update format {idx} -> {idx} + "**" + {length-1} + "**" + "{length-2}"
placeholder = "{"+ str(idx) +"}"
processed_line["format"] = processed_line["format"].replace(placeholder, placeholder + " **" + "{" + str(len(processed_line["translate_text"]) -2) + "}** {" + str(len(processed_line["translate_text"]) -1) + "}")
return processed_line
class ItalicMatcher: