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

(SDK-214) Add gettext and externalize strings #32

Merged
merged 3 commits into from
Apr 24, 2017

Conversation

scotje
Copy link
Contributor

@scotje scotje commented Apr 20, 2017

No description provided.

Copy link
Contributor

@DavidS DavidS left a comment

Choose a reason for hiding this comment

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

Einige Kleinigkeiten müssen noch ausgebessert werden, aber das muss nicht gleich passieren.

Some minor things still need changing, but those are not urgent to fix.

metadata.data.update('issues_url' => PDK::CLI::Input.get(metadata.data['issues_url']))

puts
puts '-' * 40
puts metadata.to_json
puts '-' * 40
puts
puts "About to generate this metadata; continue? [n/Y]"
puts _("About to generate this metadata; continue? [n/Y]")

if PDK::CLI::Input.get('Y') !~ /^y(es)?$/i
Copy link
Contributor

Choose a reason for hiding this comment

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

Any ideas on how to i18n this query?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, the pattern matching part? We should probably check with Larissa to see if there is an existing convention. I'm guessing that we are drawing the line at localizing the prompt and then explaining which option is affirmative in the prompt if necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I'll reach out to her. nothing to fret about just now.

lib/pdk/cli.rb Outdated
puts c.help
exit 0
end

format_desc = <<-EOS
format_desc = _(<<-EOS
Specify desired output format. Valid formats are '#{PDK::Report.formats.join("', '")}'.
Copy link
Contributor

Choose a reason for hiding this comment

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

missed a template extraction here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed!

# TODO: make this one string and have a helper function to wrap
puts _("We need to create a metadata.json file for this module. Please answer the")
puts _("following questions; if the question is not applicable to this module, feel free")
puts _("to leave it blank.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we even need to manually wrap this? Just pack it all into a single string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's more of a UX question to decide if we want to stay within a certain line width with our output. Right now CRI constrains itself to 80 characters for things like --help output. For now I will just make this a single string though.

@DavidS
Copy link
Contributor

DavidS commented Apr 21, 2017

lib/pdk/cli/*rb has not been externalized fully.

@scotje scotje force-pushed the 214_gettext_setup branch 3 times, most recently from aa1cdc5 to 3d3fad1 Compare April 21, 2017 19:10
@scotje
Copy link
Contributor Author

scotje commented Apr 22, 2017

Testing this out with a new vanagon build:

root@fo8igy67k5ptysl:/opt/puppetlabs/bin# ./pdk new module test-apache
Neues Modul: test-apache
We need to create a metadata.json file for this module. Please answer the following questions; if the question is not applicable to this module, feel free toleave it blank.

Puppet verwendet Semantic Versioning (http://semver.org) für Module.
Was ist die aktuelle Version dieses Moduls? [0.1.0]
-->

Wer ist der Autor dieses Moduls? [test]
-->

Unter welcher Lizenz ist das Modul erhältlich? [Apache-2.0]
-->

Beschreibe das Modul in einem Satz:
-->

Wo ist das Repository für dieses Modul?
-->

Wo kann man mehr über dieses Modul erfahren? [(none)]
-->

Wo kann man Fehler über dieses Modul berichten? [(none)]
-->

----------------------------------------
{
  "name": "test-apache",
  "version": "0.1.0",
  "author": "test",
  "summary": null,
  "license": "Apache-2.0",
  "source": "",
  "project_page": null,
  "issues_url": null,
  "dependencies": [
    {
      "name": "puppetlabs-stdlib",
      "version_requirement": ">= 1.0.0"
    }
  ],
  "data_provider": null
}
----------------------------------------

Bereit metadata.json zu generieren; weitermachen? [n/Y]
-->

@DavidS DavidS force-pushed the 214_gettext_setup branch from 096553e to 34f9993 Compare April 24, 2017 14:48
@DavidS
Copy link
Contributor

DavidS commented Apr 24, 2017

I've squashed the fixups, and updated the german translation.

@DavidS DavidS merged commit f69c92c into puppetlabs:master Apr 24, 2017
@DavidS DavidS deleted the 214_gettext_setup branch April 24, 2017 15:20
@DavidS DavidS added the feature label Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants