Skip to content

Conversation

@jonfortescue
Copy link
Contributor

@jonfortescue jonfortescue commented Jun 17, 2021

Closes dotnet/core-eng#13399.

dotnet/templating has a new format for templates (per our request actually!). This adds support for it. Test build here showing it works as a proof of concept.

To double check:

$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern
$jsonTemplateFiles | ForEach-Object {
$null = $_.Name -Match "(.+)\.[\w-]+\.json" # matches '[filename].[langcode].json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$null = ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a powershell-ism. disposes the created variable :)

$jsonFiles = @()
$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\en\..+\.json" } # .NET templating pattern
$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non actionable: i just noticed that stub files create in our repo are .templatestrings.json instead of templatestrings..json

That's probably what made dotnet/templating#3296 messy:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

precisely! @bekir-ozturk and I have talked about renaming the templates so onelocbuild supports them, and this work makes sure the names are handled properly when they get pushed in.

@vlada-shubina
Copy link
Member

@jonfortescue just to double check: are you expecting repos with templates to provide files for all languages or only english? why do you need to copy the file en.templatestrings.json as templatestrings.json without lang code?

@jonfortescue
Copy link
Contributor Author

@vlada-shubina the en is the base file from which translations are created; all languages end up being returned but only one file needs to be submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants