Hide\remove language from VB.Net form list

Viewed 87

Is there a way to make the language property list shorter? Make it show only EN-US and PT-BR, for instance, so it's easier to find them?

enter image description here

1 Answers

You probably don't need to do it.. You can likely just make your life easier like:

  • Make a new form, lets say it's called LocalForm.vb
  • Drop a label on it, lets say called HelloLabel
  • Set form to de-DE, set the text of the label to Hallo
  • Set form to fr-FR, set the text of the label to Salut
  • Set the form back to (default) - you now have LocalForm.resx, LocalForm.de-DE.resx and LocalForm.fr-FR.resx and you can add controls
  • Add a Button, called StartButton
    • Double click the LocalForm.de-DE.resx file
    • Dismiss the "if you mess this up you'll have to fix it yourself" dialog
    • Add a line for StartButton.Text Starten
    • Repeat for other language files

Dropping a control named XyzButton on the form, and then visiting each LocalFor.*.resx in turn and adding the locale for it is a lot easier than back-and-forthing with the language setting, though I know why it's done the way MS chose to do it - you're supposed to lay your form out perfectly with all its hundreds of controls, and then switch to French and write all the French for all hundreds controls, and then switch to German and write it all in German.. In a use case like that there isn't a lot of work to do with that awkwardly huge Language dropdown. Incremental adds that way are a bit of a pain..

Perhaps raise a connect bug/feature asking them to put the "already used" languages (as determined by the presence of Form.*.resx files) at the top of the list, and wait many years for it to be implemented :)

Note: There's a bit of a nuisance with this "edit the resx" in that if you rename a control it doesn't always get picked up. Last time I was localizing I threw together an app that watched (FileSystemWatcher) files named *Form.resx and if it saw a change (load the current version, compare to the prev version) that was a rename, it made the same change in the other files (or maybe alerted if they weren't in sync.. can't quite remember now and I've no idea where the code has gone)

Maybe don't rename your controls after you first decide a sensible name for them/add them to the translated resx..

Related