Ticket #170: remove_google-translate.diff
| File remove_google-translate.diff, 27.6 KB (added by juanramondiaz, 13 months ago) |
|---|
-
locales/locales.php
9 9 var $slug; 10 10 var $nplurals = 2; 11 11 var $plural_expression = 'n != 1'; 12 var $google_code = null;13 12 var $preferred_sans_serif_font_family = null; 14 13 // TODO: days, months, decimals, quotes 15 14 … … 78 77 $af->country_code = 'za'; 79 78 $af->wp_locale = 'af'; 80 79 $af->slug = 'af'; 81 $af->google_code = 'af';82 80 83 81 $ak = new GP_Locale(); 84 82 $ak->english_name = 'Akan'; … … 96 94 $am->lang_code_iso_639_2 = 'amh'; 97 95 $am->country_code = 'et'; 98 96 $am->slug = 'am'; 99 $am->google_code = 'am';100 97 101 98 $an = new GP_Locale(); 102 99 $an->english_name = 'Aragonese'; … … 114 111 $ar->country_code = ''; 115 112 $ar->wp_locale = 'ar'; 116 113 $ar->slug = 'ar'; 117 $ar->google_code = 'ar';118 114 $ar->nplurals = 6; 119 115 $ar->plural_expression = 'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5'; 120 116 $ar->rtl = true; … … 162 158 $az->country_code = 'az'; 163 159 $az->wp_locale = 'az'; 164 160 $az->slug = 'az'; 165 $az->google_code = 'az';166 161 167 162 $az_tr = new GP_Locale(); 168 163 $az_tr->english_name = 'Azerbaijani (Turkey)'; … … 198 193 $be->lang_code_iso_639_2 = 'bel'; 199 194 $be->country_code = 'by'; 200 195 $be->slug = 'be'; 201 $be->google_code = 'be';202 196 $be->nplurals = 3; 203 197 $be->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 204 198 … … 210 204 $bg->country_code = 'bg'; 211 205 $bg->wp_locale = 'bg_BG'; 212 206 $bg->slug = 'bg'; 213 $bg->google_code = 'bg';214 207 215 208 $bh = new GP_Locale(); 216 209 $bh->english_name = 'Bihari'; … … 243 236 $bn_bd->country_code = 'bn'; 244 237 $bn_bd->wp_locale = 'bn_BD'; 245 238 $bn_bd->slug = 'bn'; 246 $bn_bd->google_code = 'bn';247 239 248 240 $bo = new GP_Locale(); 249 241 $bo->english_name = 'Tibetan'; … … 252 244 $bo->lang_code_iso_639_2 = 'tib'; 253 245 $bo->country_code = ''; 254 246 $bo->slug = 'bo'; 255 $bo->google_code = 'bo';256 247 $bo->nplurals = 1; 257 248 $bo->plural_expression = '0'; 258 249 … … 335 326 $cs->country_code = 'cz'; 336 327 $cs->wp_locale = 'cs_CZ'; 337 328 $cs->slug = 'cs'; 338 $cs->google_code = 'cs';339 329 $cs->nplurals = 3; 340 330 $cs->plural_expression = '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'; 341 331 … … 373 363 $cy->country_code = 'uk'; 374 364 $cy->wp_locale = 'cy'; 375 365 $cy->slug = 'cy'; 376 $cy->google_code = 'cy';377 366 $cy->nplurals = 4; 378 367 $cy->plural_expression = '(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3'; 379 368 … … 385 374 $da->country_code = 'dk'; 386 375 $da->wp_locale = 'da_DK'; 387 376 $da->slug = 'da'; 388 $da->google_code = 'da';389 377 390 378 $de = new GP_Locale(); 391 379 $de->english_name = 'German'; … … 394 382 $de->country_code = 'de'; 395 383 $de->wp_locale = 'de_DE'; 396 384 $de->slug = 'de'; 397 $de->google_code = 'de';398 385 399 386 $dv = new GP_Locale(); 400 387 $dv->english_name = 'Divehi'; … … 404 391 $dv->country_code = 'mv'; 405 392 $dv->wp_locale = 'dv'; 406 393 $dv->slug = 'dv'; 407 $dv->google_code = 'dv';408 394 $dv->rtl = true; 409 395 410 396 $dz = new GP_Locale(); … … 441 427 $el->country_code = 'gr'; 442 428 $el->wp_locale = 'el'; 443 429 $el->slug = 'el'; 444 $el->google_code = 'el';445 430 446 431 $en = new GP_Locale(); 447 432 $en->english_name = 'English'; … … 450 435 $en->country_code = 'us'; 451 436 $en->wp_locale = 'en_US'; 452 437 $en->slug = 'en'; 453 $en->google_code = 'en';454 438 455 439 $en_ca = new GP_Locale(); 456 440 $en_ca->english_name = 'English (Canada)'; … … 461 445 $en_ca->country_code = 'ca'; 462 446 $en_ca->wp_locale = 'en_CA'; 463 447 $en_ca->slug = 'en-ca'; 464 $en_ca->google_code = 'en';465 448 466 449 $en_gb = new GP_Locale(); 467 450 $en_gb->english_name = 'English (UK)'; … … 471 454 $en_gb->lang_code_iso_639_3 = 'eng'; 472 455 $en_gb->country_code = 'gb'; 473 456 $en_gb->wp_locale = 'en_GB'; 474 $en_gb->slug = 'en-gb'; 475 $en_gb->google_code = 'en'; 457 $en_gb->slug = 'en-gb'; 476 458 477 459 $eo = new GP_Locale(); 478 460 $eo->english_name = 'Esperanto'; … … 482 464 $eo->country_code = ''; 483 465 $eo->wp_locale = 'eo'; 484 466 $eo->slug = 'eo'; 485 $eo->google_code = 'eo';486 467 487 468 $es_cl = new GP_Locale(); 488 469 $es_cl->english_name = 'Spanish (Chile)'; … … 492 473 $es_cl->country_code = 'cl'; 493 474 $es_cl->wp_locale = 'es_CL'; 494 475 $es_cl->slug = 'es-cl'; 495 $es_cl->google_code = 'es';496 476 497 477 $es_pe = new GP_Locale(); 498 478 $es_pe->english_name = 'Spanish (Peru)'; … … 502 482 $es_pe->country_code = 'pe'; 503 483 $es_pe->wp_locale = 'es_PE'; 504 484 $es_pe->slug = 'es-pe'; 505 $es_pe->google_code = 'es';506 485 507 486 $es_pr = new GP_Locale(); 508 487 $es_pr->english_name = 'Spanish (Puerto Rico)'; … … 512 491 $es_pr->country_code = 'pr'; 513 492 $es_pr->wp_locale = 'es_PR'; 514 493 $es_pr->slug = 'es-pr'; 515 $es_pr->google_code = 'es';516 494 517 495 $es_ve = new GP_Locale(); 518 496 $es_ve->english_name = 'Spanish (Venezuela)'; … … 522 500 $es_ve->country_code = 'pe'; 523 501 $es_ve->wp_locale = 'es_VE'; 524 502 $es_ve->slug = 'es-ve'; 525 $es_ve->google_code = 'es';526 503 527 504 $es_co = new GP_Locale(); 528 505 $es_co->english_name = 'Spanish (Colombia)'; … … 532 509 $es_co->country_code = 'co'; 533 510 $es_co->wp_locale = 'es_CO'; 534 511 $es_co->slug = 'es-co'; 535 $es_co->google_code = 'es';536 512 537 513 $es = new GP_Locale(); 538 514 $es->english_name = 'Spanish (Spain)'; … … 541 517 $es->country_code = 'es'; 542 518 $es->wp_locale = 'es_ES'; 543 519 $es->slug = 'es'; 544 $es->google_code = 'es';545 520 546 521 $et = new GP_Locale(); 547 522 $et->english_name = 'Estonian'; … … 551 526 $et->country_code = 'ee'; 552 527 $et->wp_locale = 'et'; 553 528 $et->slug = 'et'; 554 $et->google_code = 'et';555 529 556 530 $eu = new GP_Locale(); 557 531 $eu->english_name = 'Basque'; … … 561 535 $eu->country_code = 'es'; 562 536 $eu->wp_locale = 'eu'; 563 537 $eu->slug = 'eu'; 564 $eu->google_code = 'eu';565 538 566 539 $fa = new GP_Locale(); 567 540 $fa->english_name = 'Persian'; … … 571 544 $fa->country_code = ''; 572 545 $fa->wp_locale = 'fa_IR'; 573 546 $fa->slug = 'fa'; 574 $fa->google_code = 'fa';575 547 $fa->nplurals = 1; 576 548 $fa->plural_expression = '0'; 577 549 $fa->rtl = true; … … 584 556 $fa_af->country_code = ''; 585 557 $fa_af->wp_locale = 'fa_AF'; 586 558 $fa_af->slug = 'fa-af'; 587 $fa_af->google_code = 'fa';588 559 $fa_af->nplurals = 1; 589 560 $fa_af->plural_expression = '0'; 590 561 $fa_af->rtl = true; … … 597 568 $fi->country_code = 'fi'; 598 569 $fi->wp_locale = 'fi'; 599 570 $fi->slug = 'fi'; 600 $fi->google_code = 'fi';601 571 602 572 $fj = new GP_Locale(); 603 573 $fj->english_name = 'Fijian'; … … 623 593 $fr->country_code = 'fr'; 624 594 $fr->wp_locale = 'fr_FR'; 625 595 $fr->slug = 'fr'; 626 $fr->google_code = 'fr';627 596 $fr->nplurals = 2; 628 597 $fr->plural_expression = 'n > 1'; 629 598 … … 668 637 $ga->lang_code_iso_639_2 = 'gle'; 669 638 $ga->country_code = 'ie'; 670 639 $ga->slug = 'ga'; 671 $ga->google_code = 'ga';672 640 $ga->nplurals = 5; 673 641 $ga->plural_expression = 'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4'; 674 642 … … 681 649 $gd->country_code = 'uk'; 682 650 $gd->wp_locale = 'gd'; 683 651 $gd->slug = 'gd'; 684 $gd->google_code = 'gd';685 652 $gd->nplurals = 4; 686 653 $gd->plural_expression = '(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3'; 687 654 … … 693 660 $gl->country_code = 'es'; 694 661 $gl->wp_locale = 'gl_ES'; 695 662 $gl->slug = 'gl'; 696 $gl->google_code = 'gl';697 663 698 664 $gn = new GP_Locale(); 699 665 $gn->english_name = 'Guaraní'; … … 703 669 $gn->country_code = ''; 704 670 $gn->wp_locale = 'gn'; 705 671 $gn->slug = 'gn'; 706 $gn->google_code = 'gn';707 672 708 673 $gu = new GP_Locale(); 709 674 $gu->english_name = 'Gujarati'; … … 712 677 $gu->lang_code_iso_639_2 = 'guj'; 713 678 $gu->country_code = ''; 714 679 $gu->slug = 'gu'; 715 $gu->google_code = 'gu';716 680 717 681 $ha = new GP_Locale(); 718 682 $ha->english_name = 'Hausa'; … … 739 703 $he->country_code = 'il'; 740 704 $he->wp_locale = 'he_IL'; 741 705 $he->slug = 'he'; 742 $he->google_code = 'iw';743 706 $he->rtl = true; 744 707 745 708 $hi = new GP_Locale(); … … 750 713 $hi->country_code = 'in'; 751 714 $hi->wp_locale = 'hi_IN'; 752 715 $hi->slug = 'hi'; 753 $hi->google_code = 'hi';754 716 755 717 $hr = new GP_Locale(); 756 718 $hr->english_name = 'Croatian'; … … 760 722 $hr->country_code = 'hr'; 761 723 $hr->wp_locale = 'hr'; 762 724 $hr->slug = 'hr'; 763 $hr->google_code = 'hr';764 725 $hr->nplurals = 3; 765 726 $hr->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 766 727 … … 772 733 $hu->country_code = 'hu'; 773 734 $hu->wp_locale = 'hu_HU'; 774 735 $hu->slug = 'hu'; 775 $hu->google_code = 'hu';776 736 777 737 $hy = new GP_Locale(); 778 738 $hy->english_name = 'Armenian'; … … 800 760 $id->country_code = 'id'; 801 761 $id->wp_locale = 'id_ID'; 802 762 $id->slug = 'id'; 803 $id->google_code = 'id';804 763 $id->nplurals = 2; 805 764 $id->plural_expression = 'n > 1'; 806 765 … … 827 786 $is->lang_code_iso_639_2 = 'isl'; 828 787 $is->country_code = 'is'; 829 788 $is->slug = 'is'; 830 $is->google_code = 'is';831 789 $is->wp_locale = 'is_IS'; 832 790 $is->nplurals = 2; 833 791 $is->plural_expression = '(n % 100 != 1 && n % 100 != 21 && n % 100 != 31 && n % 100 != 41 && n % 100 != 51 && n % 100 != 61 && n % 100 != 71 && n % 100 != 81 && n % 100 != 91)'; … … 840 798 $it->country_code = 'it'; 841 799 $it->wp_locale = 'it_IT'; 842 800 $it->slug = 'it'; 843 $it->google_code = 'it';844 801 845 802 $ja = new GP_Locale(); 846 803 $ja->english_name = 'Japanese'; … … 849 806 $ja->country_code = 'jp'; 850 807 $ja->wp_locale = 'ja'; 851 808 $ja->slug = 'ja'; 852 $ja->google_code = 'ja';853 809 $ja->nplurals = 1; 854 810 $ja->plural_expression = '0'; 855 811 … … 870 826 $ka->country_code = 'ge'; 871 827 $ka->wp_locale = 'ka_GE'; 872 828 $ka->slug = 'ka'; 873 $ka->google_code = 'ka';874 829 $ka->nplurals = 1; 875 830 $ka->plural_expression = '0'; 876 831 … … 882 837 $kk->country_code = 'kz'; 883 838 $kk->wp_locale = 'kk'; 884 839 $kk->slug = 'kk'; 885 $kk->google_code = 'kk';886 840 887 841 $km = new GP_Locale(); 888 842 $km->english_name = 'Khmer'; … … 891 845 $km->lang_code_iso_639_2 = 'khm'; 892 846 $km->country_code = 'kh'; 893 847 $km->slug = 'km'; 894 $km->google_code = 'km';895 848 $km->nplurals = 1; 896 849 $km->plural_expression = '0'; 897 850 … … 903 856 $kn->country_code = 'in'; 904 857 $kn->wp_locale = 'kn'; 905 858 $kn->slug = 'kn'; 906 $kn->google_code = 'kn';907 859 908 860 $ko = new GP_Locale(); 909 861 $ko->english_name = 'Korean'; … … 913 865 $ko->country_code = 'kr'; 914 866 $ko->wp_locale = 'ko_KR'; 915 867 $ko->slug = 'ko'; 916 $ko->google_code = 'ko';917 868 $ko->nplurals = 1; 918 869 $ko->plural_expression = '0'; 919 870 … … 932 883 $ku->lang_code_iso_639_2 = 'kur'; 933 884 $ku->country_code = 'ku'; 934 885 $ku->slug = 'ku'; 935 $ku->google_code = 'ku';936 886 937 887 $ky = new GP_Locale(); 938 888 $ky->english_name = 'Kirghiz'; … … 970 920 $li->country_code = 'nl'; 971 921 $li->wp_locale = 'li'; 972 922 $li->slug = 'li'; 973 $li->google_code = 'li';974 923 975 924 $lo = new GP_Locale(); 976 925 $lo->english_name = 'Lao'; … … 980 929 $lo->country_code = ''; 981 930 $lo->wp_locale = 'lo'; 982 931 $lo->slug = 'lo'; 983 $lo->google_code = 'lo';984 932 $lo->nplurals = 1; 985 933 $lo->plural_expression = '0'; 986 934 … … 991 939 $lt->lang_code_iso_639_2 = 'lit'; 992 940 $lt->country_code = 'lt'; 993 941 $lt->slug = 'lt'; 994 $lt->google_code = 'lt';995 942 $lt->nplurals = 3; 996 943 $lt->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)'; 997 944 … … 1003 950 $lv->country_code = 'lv'; 1004 951 $lv->wp_locale = 'lv'; 1005 952 $lv->slug = 'lv'; 1006 $lv->google_code = 'lv';1007 953 $lv->nplurals = 3; 1008 954 $lv->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2)'; 1009 955 … … 1013 959 $me->lang_code_iso_639_1 = 'me'; 1014 960 $me->country_code = 'me'; 1015 961 $me->wp_locale = 'me_ME'; 1016 $me->google_code = 'srp';1017 962 $me->slug = 'me'; 1018 963 1019 964 $mg = new GP_Locale(); … … 1033 978 $mhr->lang_code_iso_639_3 = 'mhr'; 1034 979 $mhr->country_code = 'ru'; 1035 980 $mhr->slug = 'mhr'; 1036 $mhr->google_code = 'chm';1037 981 1038 982 $mk = new GP_Locale(); 1039 983 $mk->english_name = 'Macedonian'; … … 1043 987 $mk->country_code = 'mk'; 1044 988 $mk->wp_locale = 'mk_MK'; 1045 989 $mk->slug = 'mk'; 1046 $mk->google_code = 'mk';1047 990 $mk->nplurals = 2; 1048 991 $mk->plural_expression = 'n==1 || n%10==1 ? 0 : 1'; 1049 992 … … 1055 998 $ml->country_code = 'in'; 1056 999 $ml->wp_locale = 'ml_IN'; 1057 1000 $ml->slug = 'ml'; 1058 $ml->google_code = 'ml';1059 1001 1060 1002 $mn = new GP_Locale(); 1061 1003 $mn->english_name = 'Mongolian'; … … 1064 1006 $mn->lang_code_iso_639_2 = 'mon'; 1065 1007 $mn->country_code = 'mn'; 1066 1008 $mn->slug = 'mn'; 1067 $mn->google_code = 'mn';1068 1009 1069 1010 $mr = new GP_Locale(); 1070 1011 $mr->english_name = 'Marathi'; … … 1073 1014 $mr->lang_code_iso_639_2 = 'mar'; 1074 1015 $mr->country_code = ''; 1075 1016 $mr->slug = 'mr'; 1076 $mr->google_code = 'mr';1077 1017 1078 1018 $mrj = new GP_Locale(); 1079 1019 $mrj->english_name = 'Mari (Hill)'; … … 1083 1023 $mrj->lang_code_iso_639_3 = 'mrj'; 1084 1024 $mrj->country_code = 'ru'; 1085 1025 $mrj->slug = 'mrj'; 1086 $mrj->google_code = 'chm';1087 1026 1088 1027 $ms = new GP_Locale(); 1089 1028 $ms->english_name = 'Malay'; … … 1093 1032 $ms->country_code = ''; 1094 1033 $ms->wp_locale = 'ms_MY'; 1095 1034 $ms->slug = 'ms'; 1096 $ms->google_code = 'ms';1097 1035 $ms->nplurals = 1; 1098 1036 $ms->plural_expression = '0'; 1099 1037 … … 1113 1051 $my->country_code = 'mm'; 1114 1052 $my->wp_locale = 'my_MM'; 1115 1053 $my->slug = 'mya'; 1116 $my->google_code = 'my';1117 1054 1118 1055 $ne = new GP_Locale(); 1119 1056 $ne->english_name = 'Nepali'; … … 1132 1069 $nb->country_code = 'no'; 1133 1070 $nb->wp_locale = 'nb_NO'; 1134 1071 $nb->slug = 'nb'; 1135 $nb->google_code = 'no';1136 1072 1137 1073 $nl = new GP_Locale(); 1138 1074 $nl->english_name = 'Dutch'; … … 1142 1078 $nl->country_code = 'nl'; 1143 1079 $nl->wp_locale = 'nl_NL'; 1144 1080 $nl->slug = 'nl'; 1145 $nl->google_code = 'nl';1146 1081 1147 1082 $nl_be = new GP_Locale(); 1148 1083 $nl_be->english_name = 'Dutch (Belgium)'; … … 1152 1087 $nl_be->country_code = 'be'; 1153 1088 $nl_be->wp_locale = 'nl_BE'; 1154 1089 $nl_be->slug = 'nl-be'; 1155 $nl_be->google_code = 'nl';1156 1090 1157 1091 $nn = new GP_Locale(); 1158 1092 $nn->english_name = 'Norwegian (Nynorsk)'; … … 1170 1104 $no->lang_code_iso_639_2 = 'nor'; 1171 1105 $no->country_code = 'no'; 1172 1106 $no->slug = 'no'; 1173 $no->google_code = 'no';1174 1107 1175 1108 $oc = new GP_Locale(); 1176 1109 $oc->english_name = 'Occitan'; … … 1206 1139 $pl->country_code = 'pl'; 1207 1140 $pl->wp_locale = 'pl_PL'; 1208 1141 $pl->slug = 'pl'; 1209 $pl->google_code = 'pl';1210 1142 $pl->nplurals = 3; 1211 1143 $pl->plural_expression = '(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 1212 1144 … … 1219 1151 $pt_br->country_code = 'br'; 1220 1152 $pt_br->wp_locale = 'pt_BR'; 1221 1153 $pt_br->slug = 'pt-br'; 1222 $pt_br->google_code = 'pt-PT';1223 1154 $pt_br->nplurals = 2; 1224 1155 $pt_br->plural_expression = '(n > 1)'; 1225 1156 … … 1230 1161 $pt->country_code = 'pt'; 1231 1162 $pt->wp_locale = 'pt_PT'; 1232 1163 $pt->slug = 'pt'; 1233 $pt->google_code = 'pt-PT';1234 1164 1235 1165 $ps = new GP_Locale(); 1236 1166 $ps->english_name = 'Pashto'; … … 1239 1169 $ps->country_code = ''; 1240 1170 $ps->wp_locale = 'ps'; 1241 1171 $ps->slug = 'ps'; 1242 $ps->google_code = 'ps';1243 1172 $ps->rtl = true; 1244 1173 1245 1174 $ro = new GP_Locale(); … … 1250 1179 $ro->country_code = 'ro'; 1251 1180 $ro->wp_locale = 'ro_RO'; 1252 1181 $ro->slug = 'ro'; 1253 $ro->google_code = 'ro';1254 1182 $ro->nplurals = 3; 1255 1183 $ro->plural_expression = '(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2)'; 1256 1184 … … 1262 1190 $ru->country_code = 'ru'; 1263 1191 $ru->wp_locale = 'ru_RU'; 1264 1192 $ru->slug = 'ru'; 1265 $ru->google_code = 'ru';1266 1193 $ru->nplurals = 3; 1267 1194 $ru->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 1268 1195 … … 1274 1201 $ru_ua->country_code = 'ua'; 1275 1202 $ru_ua->wp_locale = 'ru_UA'; 1276 1203 $ru_ua->slug = 'ru-ua'; 1277 $ru_ua->google_code = 'ru';1278 1204 $ru_ua->nplurals = 3; 1279 1205 $ru_ua->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 1280 1206 … … 1327 1253 $sd->country_code = 'pk'; 1328 1254 $sd->wp_locale = 'sd_PK'; 1329 1255 $sd->slug = 'sd'; 1330 $sd->google_code = 'sd';1331 1256 1332 1257 $si = new GP_Locale(); 1333 1258 $si->english_name = 'Sinhala'; … … 1337 1262 $si->country_code = 'lk'; 1338 1263 $si->wp_locale = 'si_LK'; 1339 1264 $si->slug = 'si'; 1340 $si->google_code = 'si';1341 1265 1342 1266 $sk = new GP_Locale(); 1343 1267 $sk->english_name = 'Slovak'; … … 1347 1271 $sk->country_code = 'sk'; 1348 1272 $sk->slug = 'sk'; 1349 1273 $sk->wp_locale = 'sk_SK'; 1350 $sk->google_code = 'sk';1351 1274 $sk->nplurals = 3; 1352 1275 $sk->plural_expression = '(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2'; 1353 1276 … … 1359 1282 $sl->country_code = 'si'; 1360 1283 $sl->wp_locale = 'sl_SI'; 1361 1284 $sl->slug = 'sl'; 1362 $sl->google_code = 'sl';1363 1285 $sl->nplurals = 4; 1364 1286 $sl->plural_expression = '(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)'; 1365 1287 … … 1372 1294 $so->country_code = 'so'; 1373 1295 $so->wp_locale = 'so_SO'; 1374 1296 $so->slug = 'so'; 1375 $so->google_code = 'so';1376 1297 1377 1298 $sq = new GP_Locale(); 1378 1299 $sq->english_name = 'Albanian'; … … 1382 1303 $sq->wp_locale = 'sq'; 1383 1304 $sq->country_code = 'al'; 1384 1305 $sq->slug = 'sq'; 1385 $sq->google_code = 'sq';1386 1306 1387 1307 $sr = new GP_Locale(); 1388 1308 $sr->english_name = 'Serbian'; … … 1392 1312 $sr->country_code = 'rs'; 1393 1313 $sr->wp_locale = 'sr_RS'; 1394 1314 $sr->slug = 'sr'; 1395 $sr->google_code = 'sr';1396 1315 $sr->nplurals = 3; 1397 1316 $sr->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 1398 1317 … … 1424 1343 $sv->country_code = 'se'; 1425 1344 $sv->wp_locale = 'sv_SE'; 1426 1345 $sv->slug = 'sv'; 1427 $sv->google_code = 'sv';1428 1346 1429 1347 $sw = new GP_Locale(); 1430 1348 $sw->english_name = 'Swahili'; … … 1434 1352 $sw->country_code = ''; 1435 1353 $sw->wp_locale = 'sw'; 1436 1354 $sw->slug = 'sw'; 1437 $sw->google_code = 'sw';1438 1355 1439 1356 $ta = new GP_Locale(); 1440 1357 $ta->english_name = 'Tamil'; … … 1444 1361 $ta->country_code = 'IN'; 1445 1362 $ta->wp_locale = 'ta_IN'; 1446 1363 $ta->slug = 'ta'; 1447 $ta->google_code = 'ta';1448 1364 1449 1365 $ta_lk = new GP_Locale(); 1450 1366 $ta_lk->english_name = 'Tamil (Sri Lanka)'; … … 1454 1370 $ta_lk->country_code = 'LK'; 1455 1371 $ta_lk->wp_locale = 'ta_LK'; 1456 1372 $ta_lk->slug = 'ta-lk'; 1457 $ta_lk->google_code = 'ta';1458 1373 1459 1374 $te = new GP_Locale(); 1460 1375 $te->english_name = 'Telugu'; … … 1464 1379 $te->country_code = ''; 1465 1380 $te->wp_locale = 'te'; 1466 1381 $te->slug = 'te'; 1467 $te->google_code = 'te';1468 1382 1469 1383 $th = new GP_Locale(); 1470 1384 $th->english_name = 'Thai'; … … 1474 1388 $th->country_code = ''; 1475 1389 $th->wp_locale = 'th'; 1476 1390 $th->slug = 'th'; 1477 $th->google_code = 'th';1478 1391 $th->nplurals = 1; 1479 1392 $th->plural_expression = '0'; 1480 1393 … … 1495 1408 $tl->lang_code_iso_639_2 = 'tgl'; 1496 1409 $tl->country_code = 'ph'; 1497 1410 $tl->slug = 'tl'; 1498 $tl->google_code = 'tl';1499 1411 1500 1412 $tr = new GP_Locale(); 1501 1413 $tr->english_name = 'Turkish'; … … 1505 1417 $tr->country_code = 'tr'; 1506 1418 $tr->wp_locale = 'tr_TR'; 1507 1419 $tr->slug = 'tr'; 1508 $tr->google_code = 'tr';1509 1420 $tr->nplurals = 2; 1510 1421 $tr->plural_expression = '(n > 1)'; 1511 1422 … … 1525 1436 $ug->country_code = 'cn'; 1526 1437 $ug->wp_locale = 'ug_CN'; 1527 1438 $ug->slug = 'ug'; 1528 $ug->google_code = 'ug';1529 1439 1530 1440 $uk = new GP_Locale(); 1531 1441 $uk->english_name = 'Ukrainian'; … … 1535 1445 $uk->country_code = 'ua'; 1536 1446 $uk->wp_locale = 'uk'; 1537 1447 $uk->slug = 'uk'; 1538 $uk->google_code = 'uk';1539 1448 $uk->nplurals = 3; 1540 1449 $uk->plural_expression = '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'; 1541 1450 … … 1547 1456 $ur->country_code = ''; 1548 1457 $ur->wp_locale = 'ur'; 1549 1458 $ur->slug = 'ur'; 1550 $ur->google_code = 'ur';1551 1459 1552 1460 $uz = new GP_Locale(); 1553 1461 $uz->english_name = 'Uzbek'; … … 1557 1465 $uz->country_code = 'uz'; 1558 1466 $uz->wp_locale = 'uz_UZ'; 1559 1467 $uz->slug = 'uz'; 1560 $uz->google_code = 'uz';1561 1468 $uz->rtl = true; 1562 1469 $uz->nplurals = 1; 1563 1470 $uz->plural_expression = '0'; … … 1578 1485 $vi->country_code = 'vn'; 1579 1486 $vi->wp_locale = 'vi'; 1580 1487 $vi->slug = 'vi'; 1581 $vi->google_code = 'vi';1582 1488 $vi->nplurals = 1; 1583 1489 $vi->plural_expression = '0'; 1584 1490 … … 1608 1514 $yi->lang_code_iso_639_2 = 'yid'; 1609 1515 $yi->country_code = ''; 1610 1516 $yi->slug = 'yi'; 1611 $yi->google_code = 'yi';1612 1517 $yi->rtl = true; 1613 1518 1614 1519 $zh_cn = new GP_Locale(); … … 1619 1524 $zh_cn->country_code = 'cn'; 1620 1525 $zh_cn->wp_locale = 'zh_CN'; 1621 1526 $zh_cn->slug = 'zh-cn'; 1622 $zh_cn->google_code = 'zh-CN';1623 1527 $zh_cn->nplurals = 1; 1624 1528 $zh_cn->plural_expression = '0'; 1625 1529 … … 1652 1556 $zh_tw->country_code = 'tw'; 1653 1557 $zh_tw->slug = 'zh-tw'; 1654 1558 $zh_tw->wp_locale= 'zh_TW'; 1655 $zh_tw->google_code = 'zh-TW';1656 1559 $zh_tw->nplurals = 1; 1657 1560 $zh_tw->plural_expression = '0'; 1658 1561 -
gp-settings.php
276 276 277 277 require_once( GP_PATH . GP_INC . 'warnings.php' ); 278 278 require_once( GP_PATH . GP_INC . 'validation.php' ); 279 require_once( GP_PATH . GP_INC . 'google.php' );280 279 require_once( GP_PATH . GP_INC . 'advanced-permissions.php' ); 281 280 282 281 require_once GP_PATH . GP_INC . 'thing.php'; -
gp-templates/translations.php
8 8 wp_enqueue_script( 'translations-page' ); 9 9 // localizer adds var in front of the variable name, so we can't use $gp.editor.options 10 10 $editor_options = compact('can_approve', 'can_write', 'url', 'discard_warning_url', 'set_priority_url', 'set_status_url'); 11 $editor_options['google_translate_language'] = $locale->google_code;12 11 wp_localize_script( 'editor', '$gp_editor_options', $editor_options ); 13 12 $parity = gp_parity_factory(); 14 13 add_action( 'gp_head', lambda( '', 'gp_preferred_sans_serif_style_tag($locale);', compact( 'locale' ) ) ); … … 27 26 <option value="" selected="selected">Bulk Actions</option> 28 27 <option value="approve">Approve</option> 29 28 <option value="reject">Reject</option> 30 <option value="gtranslate">Translate via Google</option>31 29 </select> 32 30 <input type="hidden" name="bulk[redirect_to]" value="<?php echo esc_attr(gp_url_current()); ?>" id="bulk[redirect_to]" /> 33 31 <input type="hidden" name="bulk[row-ids]" value="" id="bulk[row-ids]" /> -
gp-templates/helper-functions.php
27 27 28 28 <?php if ( $can_edit ): ?> 29 29 <p> 30 <a href="#" class="copy" tabindex="-1"><?php _e('Copy from original'); ?></a> • 31 <a href="#" class="gtranslate" tabindex="-1"><?php _e('Translation from Google'); ?></a> 30 <a href="#" class="copy" tabindex="-1"><?php _e('Copy from original'); ?></a> 32 31 </p> 33 32 <?php else: ?> 34 33 <p> -
gp-includes/routes/translation.php
138 138 if ( 'approve' == $bulk['action'] || 'reject' == $bulk['action'] ) { 139 139 $this->_bulk_approve( $project, $locale, $translation_set, $bulk ); 140 140 } 141 142 if ( 'gtranslate' == $bulk['action'] ) {143 $this->_bulk_google_translate( $project, $locale, $translation_set, $bulk );144 }145 141 } else { 146 142 $this->errors[] = 'No translations were supplied.'; 147 143 } … … 198 194 } 199 195 } 200 196 } 201 202 function _bulk_google_translate( $project, $locale, $translation_set, $bulk ) {203 $google_errors = 0;204 $insert_errors = 0;205 $ok = 0;206 $skipped = 0;207 208 $singulars = array();209 $original_ids = array();210 foreach( $bulk['row-ids'] as $row_id ) {211 if ( gp_in( '-', $row_id) ) {212 $skipped++;213 continue;214 }215 $original_id = gp_array_get( split( '-', $row_id ), 0 );216 $original = GP::$original->get( $original_id );217 if ( !$original || $original->plural ) {218 $skipped++;219 continue;220 }221 $singulars[] = $original->singular;222 $original_ids[] = $original_id;223 }224 $results = google_translate_batch( $locale, $singulars );225 if ( is_wp_error( $results ) ) {226 error_log( print_r( $results, true ) );227 $this->errors[] = $results->get_error_message();228 return;229 }230 foreach( gp_array_zip( $original_ids, $singulars, $results ) as $item ) {231 list( $original_id, $singular, $translation ) = $item;232 if ( is_wp_error( $translation ) ) {233 $google_errors++;234 error_log( $translation->get_error_message() );235 continue;236 }237 $data = compact( 'original_id' );238 $data['user_id'] = GP::$user->current()->id;239 $data['translation_set_id'] = $translation_set->id;240 $data['translation_0'] = $translation;241 $data['status'] = 'fuzzy';242 $data['warnings'] = GP::$translation_warnings->check( $singular, null, array( $translation ), $locale );243 $inserted = GP::$translation->create( $data );244 $inserted? $ok++ : $insert_errors++;245 }246 if ( $google_errors > 0 || $insert_errors > 0 ) {247 $message = array();248 if ( $ok ) $message[] = sprintf( __('Added: %d.' ), $ok );249 if ( $google_errors ) $message[] = sprintf( __('Error from Google Translate: %d.' ), $google_errors );250 if ( $insert_errors ) $message[] = sprintf( __('Error adding: %d.' ), $insert_errors );251 if ( $skipped ) $message[] = sprintf( __('Skipped: %d.' ), $skipped );252 $this->errors[] = implode( '', $message );253 } else {254 $this->notices[] = sprintf( __('%d fuzzy translation from Google Translate were added.' ), $ok );255 }256 }257 197 258 198 function discard_warning( $project_path, $locale_slug, $translation_set_slug ) { 259 199 return $this->edit_single_translation( $project_path, $locale_slug, $translation_set_slug, array( $this, 'discard_warning_edit_function' ) ); -
js/editor.js
49 49 .on('change', 'select.priority', $gp.editor.hooks.set_priority) 50 50 .on('click', 'a.close', $gp.editor.hooks.hide) 51 51 .on('click', 'a.copy', $gp.editor.hooks.copy) 52 .on('click', 'a.gtranslate', $gp.editor.hooks.google_translate)53 52 .on('click', 'a.discard-warning', $gp.editor.hooks.discard_warning) 54 53 .on('click', 'button.approve', $gp.editor.hooks.set_status_current) 55 54 .on('click', 'button.reject', $gp.editor.hooks.set_status_rejected) … … 155 154 original_text = original_text.replace(/<span class=.invisibles.*?<\/span>/g, ''); 156 155 a = link.parents('.textareas').find('textarea').val(original_text).focus(); 157 156 }, 158 google_translate: function(link) {159 original_text = link.parents('.textareas').siblings('.original').html();160 if (!original_text) original_text = link.parents('.textareas').siblings('p:last').children('.original').html();161 if (!original_text) return;162 if (typeof google == 'undefined') {163 $gp.notices.error('Couldn’t load Google Translate library!');164 return;165 }166 $gp.notices.notice('Translating via Google Translate…');167 google.language.translate({text: original_text, type: 'html'}, 'en', $gp_editor_options.google_translate_language, function(result) {168 if (!result.error) {169 // fix common google translate misbehaviours170 result.translation = result.translation.replace(/% (s|d)/gi, function(m, letter) {171 return '%'+letter.toLowerCase();172 });173 result.translation = result.translation.replace(/% (\d+) \$ (S|D)/gi, function(m, number, letter) {174 return '%'+number+'$'+letter.toLowerCase();175 });176 result.translation = result.translation.replace(/<\/\s+([A-Z]+)>/g, function(m, tag) {177 return '</'+tag.toLowerCase()+'>';178 });179 180 link.parent('p').siblings('textarea').html(result.translation).focus();181 $gp.notices.success('Translated!');182 } else {183 $gp.notices.error('Error in translating via Google Translate: '+result.message+'!');184 link.parent('p').siblings('textarea').focus();185 }186 });187 },188 157 hooks: { 189 158 show: function() { 190 159 $gp.editor.show($(this)); … … 202 171 $gp.editor.copy($(this)); 203 172 return false; 204 173 }, 205 google_translate: function() {206 $gp.editor.google_translate($(this));207 return false;208 },209 174 discard_warning: function() { 210 175 $gp.editor.discard_warning($(this)); 211 176 return false; … … 225 190 } 226 191 }}(jQuery); 227 192 228 if (typeof google != 'undefined') google.load("language", "1");229 230 193 jQuery(function($) { 231 194 $gp.editor.init($('#translations')); 232 195 });
