cckec / winetricks

Automatically exported from code.google.com/p/winetricks
0 stars 0 forks source link

winetricks should install packages according to user's langauge #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. winetricks mdac28
2. LC_ALL=pl_PL wine control
3. I see "Data Sources (ODBC)"

What is the expected output? What do you see instead?
I ought to be seeing "Źródła danych (ODBC)" (see attachment)

What version of the product are you using? On what operating system?
WINETRICKS_VERSION=20110312 on Fedora 14

Please provide any additional information below.
To do thing right I modified load_mdac28

load_mdac28()
{
    # http://www.microsoft.com/downloads/en/details.aspx?familyid=78cac895-efc2-4f8e-a9e0-3a1afbd5922e
    if [ $LC_ALL = pl_PL ]
    then
        w_download http://download.microsoft.com/download/1/d/d/1ddafd18-4c6d-40e4-8d6c-9eb43420d1b5/MDAC_TYP.EXE 1a2716c296f5a1acf1ce4c31f09d1959af26705c
    else
        w_download http://download.microsoft.com/download/4/a/a/4aafff19-9d21-4d35-ae81-02c48dcbbbff/MDAC_TYP.EXE 4fbc272c79da59e38818924d8575accb0af776fb
    fi
    load_native_mdac
    w_set_winver win98
    cd "$W_CACHE"/mdac28
    if [ $W_UNATTENDED_SLASH_Q ]
    then
        w_try $WINE mdac_typ.exe /q /C:"setup /QNT"
    else
        w_try $WINE mdac_typ.exe
    fi
    w_unset_winver
}

Above procedure would look better if Polish MDAC_TYP.EXE would not overwrite 
English MDAC_TYP.EXE and would be stored in other directory.

Original issue reported on code.google.com by Lukasz.W...@gmail.com on 18 Mar 2011 at 9:00

Attachments:

GoogleCodeExporter commented 8 years ago
Good idea.  (Probably switch rather than if.)

I've added this to
http://code.google.com/p/winetricks/wiki/SummerOfCode

Original comment by daniel.r...@gmail.com on 20 Mar 2011 at 11:13

GoogleCodeExporter commented 8 years ago
It seems that some `case $LANG in ...` stuffs would be used to deal with all 
the languages since there are so many to choose from.

With a given MS Download id (that ?id=5793 in the HTML Query), download URLs 
for each locale available can be obtained like this:

```Bash
#! /bin/bash
# INCOMPLETE: Regex.. Ahhhh
ID=5793
# Guess sed version by using help
_esed(){ if sed --help >/dev/null; then sed -r "$@"; else sed -E "$@"; fi }
# Oh crap I hate regex
LOCALES=$(curl http://www.microsoft.com/en-us/download/details.aspx?id=$ID | 
grep -A1 newlocale | _esed -e '/RegexToMatchTheCreepyValueAttuibuteInOption/\1 
/p')
# The option tags looks like this, and we need the value attribute:
#               <option value="zh-CN">Chinese (Simplified)</option><option 
value="zh-TW">Chinese (Traditional)</option><option 
value="cs-CZ">Czech</option><option value="da-DK">Danish</option><option 
value="nl-NL">Dutch</option><option selected="selected" 
value="en-US">English</option><option value="fi-FI">Finnish</option><option 
value="fr-FR">French</option><option value="de-DE">German</option><option 
value="el-GR">Greek</option><option value="he-IL">Hebrew</option><option 
value="hu-HU">Hungarian</option><option value="it-IT">Italian</option><option 
value="ja-JP">Japanese</option><option value="ko-KR">Korean</option><option 
value="nb-NO">Norwegian (Bokmål)</option><option 
value="pl-PL">Polish</option><!-- And much more -->

for i in $LOCALES; do
  printf $i'\t'
  curl http://www.microsoft.com/$i/download/confirmation.aspx?id=$ID | grep start-download | # Again, get the href attribute from the a tag..
done

Original comment by `arthur200126` on 6 Feb 2015 at 3:53
GoogleCodeExporter commented 8 years ago
Hmm.. Just ignore the sed stuff and take what I posted as pseudo-sh-code.

Original comment by arthur200126 on 6 Feb 2015 at 4:18

GoogleCodeExporter commented 8 years ago
Final Script.
```sh
#! /bin/sh
ID=${1-5793}
FILEEXT=${2-(msi|exe)}
echo "Download links for MS package ID $ID:" >&2
  # So it doesn't get jammed with cut in stdout
  # We can do one more grep to get the name of the package but it's not really useful.
  # BUF=$(curl --silent sameURL); NAME=$(echo $BUF | grep -A1 '<h1>' | tail -n 1); LOCALES=$(echo $BUF | same thing); 
LOCALES=$(curl --silent 
http://www.microsoft.com/en-us/download/details.aspx?id=$ID | grep -A1 
newlocale | grep -Eo '[a-z]{2}-[A-Z]{2}')

for i in $LOCALES; do
  printf $i'\t'
  curl --silent http://www.microsoft.com/$i/download/confirmation.aspx?id=$ID | grep 'failover' | grep -Eio 'http://download.microsoft.com/download/([0-9a-f]/){3}[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.*\.'$FILEEXT
done

Original comment by `arthur200126` on 6 Feb 2015 at 5:18
GoogleCodeExporter commented 8 years ago
Microsoft always do something unexpected..
  curl --silent http://www.microsoft.com/$i/download/confirmation.aspx?id=$ID | grep 'failover' | grep -Eio 'http://download.microsoft.com/download/([0-9a-f]/){3}[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.*\.'$FILEEXT | head -n 1
Why were there so many links on confirmation for XP SP3…

Original comment by arthur200126 on 6 Feb 2015 at 5:21