Giter Site home page Giter Site logo

measurelocalizeddata's Introduction

MeasureLocalizedData

Control the localized keys used with Import-LocalizedData. Retrieves the nonexistent keys and the unused keys.

To install this module :

$PSGalleryPublishUri = 'https://www.myget.org/F/ottomatt/api/v2/package'
$PSGallerySourceUri = 'https://www.myget.org/F/ottomatt/api/v2'

Register-PSRepository -Name OttoMatt -SourceLocation $PSGallerySourceUri -PublishLocation $PSGalleryPublishUri #-InstallationPolicy Trusted
Install-Module MeasureLocalizedData -Repository OttoMatt

Control only one file, example a module :

 #PowershellGet                                                                                                            
Import-Module MeasureLocalizedData
 
$Module='.\PSModule.psm1'
Measure-ImportLocalizedData -Primary $Module

Or multiple files, example a module with several dot sourced scripts :

$Module='.\Plaster.psm1'
$Functions=@(
  '.\InvokePlaster.ps1',
  '.\TestPlasterManifest.ps1'
)

Measure-ImportLocalizedData -Primary $Module -Secondary $Functions

This call return the key nammed 'ShouldCreateNewPlasterManifest' indicated as 'unused' :

ScriptName    : 
Keys          : {ShouldCreateNewPlasterManifest}
ResourcesFile : C:\Users\Laurent\Documents\WindowsPowerShell\Modules\Plaster\en-US\Plaster.Resources.psd1
Type          : Unused
Culture       : en-US

The error relates to the resource file, so the 'ScriptName' property is not specified (not applicable).

When the error relates a script this property is specified :

ScriptName    : C:\Users\Laurent\Documents\WindowsPowerShell\Modules\Plaster\InvokePlaster.ps1
Keys          : {NotExist_in_Ressource_File}
ResourcesFile : C:\Users\Laurent\Documents\WindowsPowerShell\Modules\Plaster\en-US\Plaster.Resources.psd1
Type          : Nonexistent
Culture       : en-US

To solve the case 'unused' we must add all scripts

$Module='.\Plaster.psm1'
$Functions=@(
  '.\InvokePlaster.ps1',
  '.\TestPlasterManifest.ps1'
  '.\NewPlasterManifest.ps1'
)

Measure-ImportLocalizedData -Primary $Module -Secondary $Functions

This way, the call return no error.

This function returns a PSObject whose PSTypeName is 'LocalizedDataDiagnostic'. This object contains the following properties :

  • ScriptName : Full name of the script containing the relevant keys

  • Keys : Name of the relevant keys

  • ResourcesFile : Full Name of the localized resource file

  • Type : Error type

                - Unused      : Unused keys
                - Nonexistent : unknown keys
    
  • Culture : Name of culture tested

measurelocalizeddata's People

Contributors

laurentdardenne avatar

Watchers

 avatar

measurelocalizeddata's Issues

Add trace

Add Verbose / Debug log.

To test with PS v5.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.