Different methods for declaring UNI files


Konstantin Aladyshev
 

Hello!

I was investigating EDKII database and have found 3 ways of declaring UNI files:

1) Sources section within the INF file:
```
[Sources]
InventoryStrings.uni
VfrStrings.uni
...
```

Example:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf


2) MODULE_UNI_FILE/[UserExtensions.TianoCore."ExtraFiles"] within the INF file:
```
[Defines]
...
MODULE_UNI_FILE = ResetSystemPei.uni

...

[UserExtensions.TianoCore."ExtraFiles"]
ResetSystemPeiExtra.uni
```
Example: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf

3) PACKAGE_UNI_FILE/[UserExtensions.TianoCore."ExtraFiles"] within the DEC file:
```
[Defines]
PACKAGE_UNI_FILE = MdeModulePkg.uni

...

[UserExtensions.TianoCore."ExtraFiles"]
MdeModulePkgExtra.uni
```
Example: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModulePkg.dec

_______________________

Could someone provide me some info about all these different methods?

As I understand, all the translation strings for HII should be defined
within method 1. Am I correct?
What is the purpose of methods 2 and 3 then?
I see that these methods define strings like:
STR_MODULE_ABSTRACT
STR_MODULE_DESCRIPTION
STR_PROPERTIES_MODULE_NAME

STR_PACKAGE_ABSTRACT
STR_PACKAGE_DESCRIPTION
STR_PROPERTIES_PACKAGE_NAME

When are these strings printed? What is the point of putting
STR_MODULE_ABSTRACT/STR_MODULE_DESCRIPTION in one file and
STR_PROPERTIES_MODULE_NAME in the other "extra" file? Seems redundant.

Also I've found more strange strings in the
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModulePkg.uni

STR_gEfiMdeModulePkgTokenSpaceGuid_PcdLoadModuleAtFixAddressEnable_PROMPT
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdLoadModuleAtFixAddressEnable_HELP
STR_gEfiMdeModulePkgTokenSpaceGuid_ERR_80000001

How are they used?

Best regards,
Konstantin Aladyshev


Andrew Fish
 

On Oct 10, 2021, at 5:12 AM, Konstantin Aladyshev <aladyshev22@gmail.com> wrote:

Hello!

I was investigating EDKII database and have found 3 ways of declaring UNI files:

1) Sources section within the INF file:
```
[Sources]
InventoryStrings.uni
VfrStrings.uni
...
```

Example:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf


2) MODULE_UNI_FILE/[UserExtensions.TianoCore."ExtraFiles"] within the INF file:
```
[Defines]
...
MODULE_UNI_FILE = ResetSystemPei.uni

...

[UserExtensions.TianoCore."ExtraFiles"]
ResetSystemPeiExtra.uni
```
Example: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf

3) PACKAGE_UNI_FILE/[UserExtensions.TianoCore."ExtraFiles"] within the DEC file:
```
[Defines]
PACKAGE_UNI_FILE = MdeModulePkg.uni

...

[UserExtensions.TianoCore."ExtraFiles"]
MdeModulePkgExtra.uni
```
Example: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModulePkg.dec

_______________________

Could someone provide me some info about all these different methods?

As I understand, all the translation strings for HII should be defined
within method 1. Am I correct?
What is the purpose of methods 2 and 3 then?
Konstantin,

Your 2) and 3) are associated with the UEFI Packaging Specification [1]. You can read up on what things in the INF file mean here [2]. I think 2.16.1 will answer your questions.

TL;DR these files are not processed by the build system and used for other things.

[1] https://uefi.org/sites/default/files/resources/Dist_Package_Spec_1_1.pdf

[2] https://tianocore-docs.github.io/edk2-InfSpecification/release-1.27/2_inf_overview/216_[userextensions]_section.html#216-userextensions-section

Thanks,

Andrew Fish

I see that these methods define strings like:
STR_MODULE_ABSTRACT
STR_MODULE_DESCRIPTION
STR_PROPERTIES_MODULE_NAME

STR_PACKAGE_ABSTRACT
STR_PACKAGE_DESCRIPTION
STR_PROPERTIES_PACKAGE_NAME

When are these strings printed? What is the point of putting
STR_MODULE_ABSTRACT/STR_MODULE_DESCRIPTION in one file and
STR_PROPERTIES_MODULE_NAME in the other "extra" file? Seems redundant.

Also I've found more strange strings in the
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModulePkg.uni

STR_gEfiMdeModulePkgTokenSpaceGuid_PcdLoadModuleAtFixAddressEnable_PROMPT
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdLoadModuleAtFixAddressEnable_HELP
STR_gEfiMdeModulePkgTokenSpaceGuid_ERR_80000001

How are they used?

Best regards,
Konstantin Aladyshev