Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vcpkg::print2 and vcpkg::printf localization leftovers. #889

Merged
merged 5 commits into from
Feb 13, 2023

Conversation

BillyONeal
Copy link
Member

I changed ` in all the help topics to " because we said that ` has meaning by virtue of being an escape character. Otherwise they are copied into one big string verbatim.

@autoantwort
Copy link
Contributor

Hm changes

➜  vcpkg-tool git:(localization-more) vcpkg help binarycaching                                                               
Vcpkg can cache compiled packages to accelerate restoration on a single machine or across the
network. By default, vcpkg will save builds to a local machine cache. This can be disabled by
passing `--binarysource=clear` as the last option on the command line.

Binary caching can be further configured by either passing `--binarysource=<source>` options to
every command line or setting the `VCPKG_BINARY_SOURCES` environment variable to a set of sources
(Ex: "<source>;<source>;..."). Command line sources are interpreted after environment sources.

Valid source strings:
  clear                           Removes all previous sources
  default[,<rw>]                  Adds the default file-based location.
  files,<path>[,<rw>]             Adds a custom file-based location.
  http,<url_template>[,<rw>[,<header>]]
                                  Adds a custom http-based location. GET, HEAD and PUT request are
                                  done to download, check and upload the binaries. You can use the
                                  variables 'name', 'version', 'sha' and 'triplet'. An example url
                                  would be
                                  'https://cache.example.com/{triplet}/{name}/{version}/{sha}'. Via
                                  the header field you can set a custom header to pass an
                                  authorization token.
  nuget,<uri>[,<rw>]              Adds a NuGet-based source; equivalent to the `-Source` parameter
                                  of the NuGet CLI.
  nugetconfig,<path>[,<rw>]       Adds a NuGet-config-file-based source; equivalent to the `-Config`
                                  parameter of the NuGet CLI. This config should specify
                                  `defaultPushSource` for uploads.
  nugettimeout,<seconds>          Specifies a nugettimeout for NuGet network operations; equivalent
                                  to the `-Timeout` parameter of the NuGet CLI.
  x-azblob,<url>,<sas>[,<rw>]     **Experimental: will change or be removed without warning** Adds
                                  an Azure Blob Storage source. Uses Shared Access Signature
                                  validation. URL should include the container path.
  x-gcs,<prefix>[,<rw>]           **Experimental: will change or be removed without warning** Adds a
                                  Google Cloud Storage (GCS) source. Uses the gsutil CLI for uploads
                                  and downloads. Prefix should include the gs:// scheme and be
                                  suffixed with a `/`.
  x-aws,<prefix>[,<rw>]           **Experimental: will change or be removed without warning** Adds
                                  an AWS S3 source. Uses the aws CLI for uploads and downloads.
                                  Prefix should include s3:// scheme and be suffixed with a `/`.
  x-aws-config,<parameter>        **Experimental: will change or be removed without warning** Adds
                                  an AWS S3 source. Adds an AWS configuration; currently supports
                                  only 'no-sign-request' parameter that is an equivalent to the
                                  '--no-sign-request parameter of the AWS cli.
  x-cos,<prefix>[,<rw>]           **Experimental: will change or be removed without warning** Adds
                                  an COS source. Uses the cos CLI for uploads and downloads. Prefix
                                  should include cos:// scheme and be suffixed with a `/`.
  interactive                     Enables interactive credential management for some source types

The `<rw>` optional parameter for certain strings controls whether they will be consulted for
downloading binaries and whether on-demand builds will be uploaded to that remote. It can be
specified as 'read', 'write', or 'readwrite'.
The `nuget` and `nugetconfig` source providers additionally respect certain environment variables
while generating nuget packages. The `metadata.repository` field will be optionally generated like:

    <repository type="git" url="$VCPKG_NUGET_REPOSITORY"/>
or
    <repository type="git"
                url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
                branch="${GITHUB_REF}"
                commit="${GITHUB_SHA}"/>

if the appropriate environment variables are defined and non-empty.

NuGet's cache is not used by default. To use it for every nuget-based source, set the environment
variable `VCPKG_USE_NUGET_CACHE` to `true` (case-insensitive) or `1`.

Based on your system settings, the default path to store binaries is "/Users/leanderSchulten/.cache/vcpkg/archives". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.
Extended documentation available at 'https://github.com/Microsoft/vcpkg/tree/master/docs/users/binarycaching.md'.

to

➜  vcpkg-tool git:(localization-more) vcpkg help binarycaching
vcpkg can cache compiled packages to accelerate restoration on a single machine or across the network. By default, vcpkg will save builds to a local machine cache. This can be disabled by passing "--binarysource=clear" as the last option on the command line.

Binary caching can be further configured by either passing "--binarysource=<source>" options to every command line or setting the `VCPKG_BINARY_SOURCES` environment variable to a set of sources (Example: "<source>;<source>;..."). Command line sources are interpreted after environment sources.

Valid source strings
clear: Removes all previous sources, including defaults
default[,<rw>]: Adds the default file-based location
files,<path>[,<rw>]: Adds a custom file-based location.
http,<url_template>[,<rw>[,<header>]]
Adds a custom http-based location. GET, HEAD and PUT request are done to download, check and upload the binaries. You can use the variables {name}, {version}, {sha} and {triplet}. An example url would be 'https://cache.example.com/{triplet}/{name}/{version}/{sha}'. Via the header field you can set a custom header to pass an authorization token.
nuget,<uri>[,<rw>]
Adds a NuGet-based source; equivalent to the "-Source" parameter of the NuGet CLI.
nugetconfig,<path>[,<rw>]
Adds a NuGet-config-file-based source; equivalent to the "-Config" parameter of the NuGet CLI. This config should specify "defaultPushSource" for uploads.
nugettimeout,<seconds>
Specifies a nuget timeout for NuGet network operations; equivalent to the "-Timeout" parameter of the  NuGet CLI.x-azblob,<url>,<sas>[,<rw>]
**Experimental: will change or be removed without warning** Adds an Azure Blob Storage source. Uses Shared Access Signature validation. URL should include the container path.
x-gcs,<prefix>[,<rw>]
**Experimental: will change or be removed without warning** Adds a Google Cloud Storage (GCS) source. Uses the gsutil CLI for uploads and downloads. Prefix should include the gs:// scheme and be suffixed with a "/".
x-aws,<prefix>[,<rw>]
**Experimental: will change or be removed without warning** Adds an AWS S3 source. Uses the aws CLI for uploads and downloads. Prefix should include s3:// scheme and be suffixed with a "/".
x-aws-config,<parameter>
**Experimental: will change or be removed without warning** Adds an AWS S3 source. Adds an AWS configuration; currently supports only 'no-sign-request' parameter that is an equivalent to the '--no-sign-request parameter of the AWS CLI.
x-cos,<prefix>[,<rw>]
**Experimental: will change or be removed without warning** Adds an COS source. Uses the cos CLI for uploads and downloads. Prefix should include cos:// scheme and be suffixed with a "/".
interactive: Enables interactive credential management for some source types

The "<rw>" optional parameter for certain strings controls whether they will be consulted for downloading binaries and whether on-demand builds will be uploaded to that remote. It can be specified as "read", "write", or "readwrite".

The "nuget" and "nugetconfig" source providers additionally respect certain environment variables while generating nuget packages. The "metadata.repository" field will be optionally generated like:

<repository type="git" url="$VCPKG_NUGET_REPOSITORY"/>
or
<repository
 type="git"
 url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
 branch="${GITHUB_REF}"
 commit="${GITHUB_SHA}"/>

if the appropriate environment variables are defined and non-empty.

NuGet's cache is not used by default. To use it for every nuget-based source, set the environment variable "VCPKG_USE_NUGET_CACHE" to "true" (case-insensitive) or "1".
Based on your system settings, the default path to store binaries is "/Users/leanderSchulten/.cache/vcpkg/archives". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.
Extended documentation available at 'https://github.com/Microsoft/vcpkg/tree/master/docs/users/binarycaching.md'.

Which makes it unreadable imho

@BillyONeal
Copy link
Member Author

The problem is that I don't think there is a good / practical way to express that formatting in a way localizers can handle. They need to see the context that these are all printed together in order to be able to translate it correctly.

I think the main source of 'unreadability' here is that for some reason there is no word wrapping here but basically every terminal these days wraps?

I guess we could add more blank lines...

@autoantwort
Copy link
Contributor

Hm ok. I am not a translator but it is really impossible to correctly only translate for example

Adds an AWS S3 source. Uses the aws CLI for uploads and downloads. Prefix should include s3:// scheme and be suffixed with a "/".

tbl.text("NuGet's cache is not used by default. To use it for every nuget-based source, set the environment "
"variable `VCPKG_USE_NUGET_CACHE` to `true` (case-insensitive) or `1`.\n");
tbl.blank();
print2(tbl.m_str);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wish we didn't lose the nice formatting here :(
However, I don't think there is another way to have nice formatting and provide the necessary context to the localizers.
FYI: Sorry I missed this!

# Conflicts:
#	include/vcpkg/dependencies.h
#	src/vcpkg/commands.dependinfo.cpp
#	src/vcpkg/commands.upgrade.cpp
#	src/vcpkg/dependencies.cpp
#	src/vcpkg/install.cpp
@BillyONeal
Copy link
Member Author

@autoantwort @ras0219-msft @JavierMatosD I put table formatting back; this is slightly less localizable and it's possible that we won't get away with it, but it's worth a shot.

@BillyONeal BillyONeal merged commit bd081a7 into microsoft:main Feb 13, 2023
@BillyONeal BillyONeal deleted the localization-more branch February 13, 2023 23:28
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