MoreInfo plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Based on the NSIS forums thread: [http://forums.winamp.com/showthread.php?postid=1692707#post1692707 Released Plugin: MoreInfo, Keyword: Version info, Multilanguage, GUI Language].)
 
m (Small page fixes.)
Line 5: Line 5:
== Links ==
== Links ==


<attach>MoreInfo.zip</attach>
<attach>MoreInfo.zip</attach> (w/ Delphi source)


[http://forums.winamp.com/showthread.php?postid=1692707#post1692707 MoreInfo Forums Thread]
[http://forums.winamp.com/showthread.php?postid=1692707#post1692707 MoreInfo Forums Thread]
Line 11: Line 11:
== Description ==
== Description ==


This plugin correctly retrieves version information from files and the Windows OS '''User''' interface language (not the '''System''' language like NSIS does).
This plugin correctly retrieves version information from files and the Windows OS user interface language.


This is a better inplementation than [[FileInfo plugin]], with more accurate results.
This is a better inplementation than [[FileInfo plugin]], with more accurate results.

Revision as of 09:09, 12 June 2005

Author: onad (talk, contrib)


Links

MoreInfo.zip (29 KB) (w/ Delphi source)

MoreInfo Forums Thread

Description

This plugin correctly retrieves version information from files and the Windows OS user interface language.

This is a better inplementation than FileInfo plugin, with more accurate results.

Usage

File Information DLL Functions

Default File Properties

MoreInfo::Get<File Property> <Filename>

These functions return the values of default file properties to the stack.

<File Property>
One of the default file properties from the list below: (ie: ProductName)
  • Comments
  • PrivateBuild
  • SpecialBuild
  • ProductName
  • ProductVersion
  • CompanyName
  • FileVersion
  • FileDescription
  • LegalCopyright
  • LegalTrademarks
  • OriginalFileName
<Filename>
Valid filename where the information is taken from. (ie: "C:\Windows\MyFile.dll")

User Defined File Properties

MoreInfo::GetUserDefined <Filename> <PropertyName>

This function returns an user defined file property value to the stack.

<Filename>
Valid filename where the information is taken from. (ie: "C:\Windows\MyFile.dll")
<PropertyName>
Valid name of an user defined property you want to obtain a value from. (ie: "Language")
<Variable>
The variable where to output the return value. (ie: "$0")

OS User Language Information DLL Function

MoreInfo::GetOSUserinterfaceLanguage

This function retrives the user interface language to the stack.

<Variable>
The variable where to output the return value. (ie: "$0")

Return Value Syntax

  • If the property was found: its value will be returned (ie: "My Company");
  • If the property was not found: it will be "";
  • Otherwise, the value returned will start with "Error:", followed by an error message (ie: "Error:Unable to allocate memory.").

How the language will be determined

When the installer starts up it goes through these steps to select the interface language:

  1. Get user's default Windows OS GUI language;
  2. Find a perfect match for the language;
  3. If there is no perfect match, find a primary language match;
  4. If there is no match, use the first language defined in the script (make sure your first language is a common one like English);
  5. If the langauge variable $LANGUAGE has changed during .onInit, NSIS goes through steps 2 to 4 again, as in the case of this plugin.

As you can see the outcome of a chosen language is never un-expected.

Examples

There are two examples inside the .zip file.

1) SimpleDemo Shows of the basic functionality of MoreInfo

2) CustomLanguageDemo Fully shows the power of getting the OS GUI language. I the demo a good example of how custompage localization works and could be implemented.

Info about LCID's

The LCID, or "locale identifer," is a 32-bit data type into which are packed several different values that help to identify a particular geographical region. One of these internal values is the "primary language ID" which identifies the basic language of the region or locale, such as English, Spanish, or Turkish.

For conversion from LCID to NSIS Language define we use the following table. The table lists some common LCIDs as well as well as some less common ones that are valid for NSIS even through Windows does not recognize them by default. Note that this is this probably not a complete list of all possible LCIDs. Feel free to improve the list below.

Some Valid LCIDs. (Note: $ in front means the value is in Hexidecimal notation)

Afrikaans $0436
Albanian $041c
Arabic (Algeria) $1401
Arabic (Bahrain) $3c01
Arabic (Egypt) $0c01
Arabic (Iraq) $0801
Arabic (Jordan) $2c01
Arabic (Kuwait) $3401
Arabic (Lebanon) $3001
Arabic (Libya) $1001
Arabic (Morocco) $1801
Arabic (Oman) $2001
Arabic (Qatar) $4001
Arabic (Saudi Arabia) $0401
Arabic (Syria) $2801
Arabic (Tunisia) $1c01
Arabic (U.A.E.) $3801
Arabic (Yemen) $2401
Basque $042d
Belarusian $0423
Bulgarian $0402
Catalan $0403
Chinese (Hong Kong SAR) $0c04
Chinese (PRC) $0804
Chinese (Singapore) $1004
Chinese (Taiwan) $0404
Croatian $041a
Czech $0405
Danish $0406
Dutch (Belgian) $0813
Dutch (Standard) $0413
English (Australian) $0c09
English (Belize) $2809
English (Canadian) $1009
English (Caribbean) $2409
English (Ireland) $1809
English (Jamaica) $2009
English (New Zealand) $1409
English (South Africa) $1c09
English (Trinidad) $2c09
English (United Kingdom) $0809
English (United States) $0409
Estonian $0425
Faeroese $0438
Farsi $0429
Finnish $040b
French (Belgian) $080c
French (Canadian) $0c0c
French (Luxembourg) $140c
French (Standard) $040c
French (Swiss) $100c
German (Austrian) $0c07
German (Liechtenstein) $1407
German (Luxembourg) $1007
German (Standard) $0407
German (Swiss) $0807
Greek $0408
Hebrew $040d
Hungarian $040e
Icelandic $040f
Indonesian $0421
Italian (Standard) $0410
Italian (Swiss) $0810
Japanese $0411
Korean $0412
Korean (Johab) $0812
Latvian $0426
Lithuanian $0427
Malay (Malaysian) $043e
Malay (Brunei) $083e
Norwegian (Bokmal) $0414
Norwegian (Nynorsk) $0814
Polish $0415
Portuguese (Brazil) $0416
Portuguese (Portugal) $0816
Romanian $0418
Russian $0419
Serbian (Cyrillic) $0c1a
Serbian (Latin) $081a
Slovak $041b
Slovenian $0424
Spanish (Argentina) $2c0a
Spanish (Bolivia) $400a
Spanish (Chile) $340a
Spanish (Colombia) $240a
Spanish (Costa Rica) $140a
Spanish (Dominican Republic) $1c0a
Spanish (Ecuador) $300a
Spanish (El Salvador) $440a
Spanish (Guatemala) $100a
Spanish (Honduras) $480a
Spanish (Mexican) $080a
Spanish (Modern Sort) $0c0a
Spanish (Nicaragua) $4c0a
Spanish (Panama) $180a
Spanish (Paraguay) $3c0a
Spanish (Peru) $280a
Spanish (Puerto Rico) $500a
Spanish (Traditional Sort) $040a
Spanish (Uruguay) $380a
Spanish (Venezuela) $200a
Swahili $0441
Swedish $041d
Swedish (Finland) $081d
Thai $041e
Turkish $041f
Ukrainian $0422

Several CD/DVD methods and properties return locale identifier (LCID) values that identify which languages are available on the soundtracks or subtitles. To make use of this information, your application will need to extract the primary language ID from the returned LCID. To do this, perform a bitwise AND operation on the value of iLCID and $3FF. (The primary language ID is contained in the least significant 10 bits of the LCID.) The following code snippet shows how to do this.

iPrimaryLang = iLCID & $3FF;

To obtain an human-readable string from the primary language ID, call GetLangFromLangID as shown in this example:

sLanguage = DVD.GetLangFromLangID(iPrimaryLang);

See the Microsoft� Platform SDK for more information on LCIDs and language identifiers. The following list shows the primary language IDs for the LCIDs in the table above.

Some Valid Primary Language IDs:

Afrikaans $36
Albanian $1c
Arabic $01
Basque $2d
Belarusian $23
Bulgarian $02
Catalan $03
Chinese $04
Croatian $1a
Czech $05
Danish $06
Dutch $13
English $09
Estonian $25
Faeroese $38
Farsi $29
Finnish $0b
French $0c
German $07
Greek $08
Hebrew $0d
Hungarian $0e
Icelandic $0f
Indonesian $21
Italian $10
Japanese $11
Korean $12
Latvian $26
Lithuanian $27
Malay $3e
Norwegian $14
Polish $15
Portuguese $16
Romanian $18
Russian $19
Serbian $1a
Slovak $1b
Slovenian $24
Spanish $0a
Swahili $41
Swedish $1d
Thai $1e
Turkish $1f
Ukrainian $22

Source

Freeware, can be used anywhere by anyone, or whatever license Nullsoft has bound their wrapper with, most of the rest came from the top of my head. See the source for possible more information.

Built with Borland Delphi v7.1.1
http://www.borland.com/delphi/

Success with building customer friendly installations!

E. Onad