GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fluentui-android/GetLocalizedFiles.sh at master · microsoft/fluentui-android Expand file tree/ Copy pathGetLocalizedFiles.shMore file actions executable file ·162 lines (134 loc) · 4.34 KB / Copy pathGetLocalizedFiles.shFile metadata and controlsexecutable file ·162 lines (134 loc) · 4.34 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 #!/bin/bash id="" alias="" password="" outputDirectory="" renameLanguageFolder=true extension="" parserId=246 isoauth=false tokenServer="tdb-touchdownbuild-prod" function ParseArgs() { while getopts "nut:a:p:f:r:o:e:s:w:" arg do case "$arg" in n) renameLanguageFolder=false;; u) isoauth=true;; t) id=$OPTARG;; a) alias="$OPTARG";; p) password="$OPTARG";; f) filePath="$OPTARG";; r) relativeFilePath="$OPTARG";; o) outputDirectory="$OPTARG";; e) extension="$OPTARG";; s) parserId="$OPTARG";; w) tokenServer="$OPTARG";; -) break;; esac done } ParseArgs $* echo Team ID: $id echo Alias: $alias echo File Path: $filePath echo Relative Path: $relativeFilePath echo Parser Id: $parserId echo Output Directory: $outputDirectory if($isoauth = true); then echo "using oauth." else echo "using NTLM." fi # parse json and return value of the key function jsonValue() { KEY=$1 num=$2 jsonParseCmd=`awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p` echo $jsonParseCmd } function oauthToken () { echo "$alias" } if [ -d $filePath ]; then echo "Getting all input files from $filePath" inputFiles=$filePath/* for file in $inputFiles do fileName="${file##*/}" if [[ $fileName != "strings.xml" ]] then echo "Skipping $file" continue fi echo "Processing $file" echo "FileName $fileName" relPath=$relativeFilePath/"$fileName" echo "Relative file path $relPath" if [ "$isoauth" = false ]; then response=$(curl --ntlm -u $alias:$password -H "x-TDBuildWrapper: FluentUI-Android" -X put https://build.intlservices.microsoft.com/api/teams/$id/LocalizableFiles/ParserId/$parserId --form 'FilePath={"FilePath":"'$relPath'"};type=application/json' --form "file=@$file;type=application/octet-stream" -o "$fileName.zip") echo "Response result LocalizableFiles call $response" else tokenValue=$(oauthToken) response=$(curl -H "Authorization: Bearer $tokenValue" -H "Accept: application/json" -H "x-TDBuildWrapper: FluentUI-Android" -X put https://build.intlservices.microsoft.com/api/teams/$id/LocalizableFiles/ParserId/$parserId --form 'FilePath={"FilePath":"'$relPath'"};type=application/json' --form "file=@$file;type=application/octet-stream" -o "$fileName.zip") echo "Response result LocalizableFiles call $response" fi if [ -f $fileName.zip ]; then unzip -o $fileName.zip -d $outputDirectory rm $fileName.zip fi done elif [ -f $filePath ]; then if [ "$isoauth" = false ]; then response=$(curl --ntlm -u $alias:$password -H "x-TDBuildWrapper: FluentUI-Android" -X put https://build.intlservices.microsoft.com/api/teams/$id/LocalizableFiles/ParserId/$parserId --form 'FilePath={"FilePath":"'$relativeFilePath'"};type=application/json' --form "file=@$filePath;type=application/octet-stream" -o loc.zip) echo "Response result for LocalizableFiles call $response" else tokenValue=$(oauthToken) response=$(curl -H "Authorization: Bearer $tokenValue" -H "Accept: application/json" -H "x-TDBuildWrapper: FluentUI-Android" -X put https://build.intlservices.microsoft.com/api/teams/$id/LocalizableFiles/ParserId/$parserId --form 'FilePath={"FilePath":"'$relativeFilePath'"};type=application/json' --form "file=@$filePath;type=application/octet-stream" -o loc.zip) echo "Response result for LocalizableFiles call $response" fi if [ -f loc.zip ]; then unzip -o loc.zip -d $outputDirectory rm loc.zip fi else echo "$filePath is not valid" exit 1 fi if [ "$renameLanguageFolder" = true ]; then echo "Renaming language folders in $outputDirectory" languageFolders=$outputDirectory/*/ valuesDir=${outputDirectory%/} resDir=${valuesDir%/*} for folder in $languageFolders do echo "Folder is: $folder" folderWithoutTrailingSlash=${folder#${outputDirectory}/} echo "folderWithoutTrailingSlash is: $folderWithoutTrailingSlash" if [ $(echo $folderWithoutTrailingSlash | grep -o "-" | wc -l) -gt "1" ]; then folderWithoutTrailingSlash=b+$(echo "$folderWithoutTrailingSlash" | tr - +) else folderWithoutTrailingSlash=$(echo "${folderWithoutTrailingSlash//-/"-r"}") fi echo "Renaming $folder to "${outputDirectory}/values-${folderWithoutTrailingSlash}"" if [ -d "${resDir}/values-${folderWithoutTrailingSlash}" ] then echo "Deleting values-$folderWithoutTrailingSlash from ${resDir} as it already exists" rm -r "${resDir}/values-${folderWithoutTrailingSlash}" fi mv $folder "${outputDirectory}/values-${folderWithoutTrailingSlash}" mv ${valuesDir}/values-${folderWithoutTrailingSlash} $resDir done fi |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |