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

Add button/placeholder translations and a complete german localization #353

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

benurb
Copy link
Contributor

@benurb benurb commented Feb 22, 2015

Hello Jeremy,

thanks for your very cool editor 👍
For our project we needed a version with localized button captions, so I've created a feature branch on our fork, which you might want to integrate. If you have any suggestions for improvements they are very welcome.
I've seen #196, but it's not doing the whole translation (e.g. no button texts and no placeholder translation).

Best regards,
Benjamin

@jdorn
Copy link
Owner

jdorn commented Feb 22, 2015

Thanks, this is really cool! My only worry is that you have Grunt including all language files in the build, which will increase the size of the library for everyone, even those just using a single language. It's not a huge problem with just two languages, but it can get out of control quickly.

I'll look at how some other libraries handle this, but I'm thinking one of these ways could work:

  1. The default build only includes English. You can use another language instead with a grunt command line option (e.g. grunt --language=de)
  2. Or create separate dist files for each language automatically (e.g. dist/jsoneditor.de.js and dist/jsoneditor.de.min.js).

Both ways have their pros and cons.

@benurb
Copy link
Contributor Author

benurb commented Feb 22, 2015

Mhh, i think the second option is the better one. Other libs like jQuery UI have it that way. I can change the PR to this if you want.
The first one could be problematic when you want all locales or all but one, etc.

@Mattes1000
Copy link
Contributor

👍 for second option

…l concatenated into the main jsoneditor(.min).js)
@benurb
Copy link
Contributor Author

benurb commented Feb 24, 2015

Hello,

@jdorn: after reading your comment a third time I'm not sure if I understood you correctly, but what I did now is the following:

  1. Include the english locale into the main dist/jsoneditor(.min).js
  2. Create seperate files for each locale in dist/languages/
    To use for example the german locale you have to do this:
<script src="./dist/jsoneditor.min.js"></script>
<script src="./dist/languages/de.min.js"></script>

<script>
JSONEditor.defaults.language = 'de';
// ...
</script>

It's no problem to prefix the language files with jsoneditor. and skip the languages subfolder or something else. Just drop me your opinion.

Best regards,
Benjamin

@CalaxDev
Copy link

Could this please be merged? This would be very useful.

@benurb
Copy link
Contributor Author

benurb commented Aug 11, 2015

Any news on this? Should I resolve the merge conflicts?

@N4M3Z
Copy link

N4M3Z commented Sep 9, 2015

+1

1 similar comment
@vojtagrec
Copy link

+1

@dwt
Copy link

dwt commented Feb 10, 2017

Not sure if this helps this pull request, but I changed the localization to conform to the current release

// From https://github.com/jdorn/json-editor/pull/353 with some adaptiations

JSONEditor.defaults.languages.de = {
  /**
   * When a property is not set
   */
  error_notset: "Attribut muss gesetzt sein",
  /**
   * When a string must not be empty
   */
  error_notempty: "Eingabe benötigt",
  /**
   * When a value is not one of the enumerated values
   */
  error_enum: "Die Eingabe muss einem der aufgeführten Werte entsprechen",
  /**
   * When a value doesn't validate any schema of a 'anyOf' combination
   */
  error_anyOf: "Die Eingabe muss gegen mindestens eines der gegebenen Schemata validiert werden können",
  /**
   * When a value doesn't validate
   * @variables This key takes one variable: The number of schemas the value does not validate
   */
  error_oneOf: 'Die Eingabe muss gegen genau eines der gegebenen Schemata validiert werden können. Momentan können {{0}} Schemata validiert werden',
  /**
   * When a value does not validate a 'not' schema
   */
  error_not: "Die Eingabe darf nicht gegen das gegebene Schema validiert werden können",
  /**
   * When a value does not match any of the provided types
   */
  error_type_union: "Die Eingabe muss einem der gegebenen Typen entsprechen",
  /**
   * When a value does not match the given type
   * @variables This key takes one variable: The type the value should be of
   */
  error_type: "Die Eingabe muss vom Typ {{0}} sein",
  /**
   *  When the value validates one of the disallowed types
   */
  error_disallow_union: "Die Eingabe darf nicht einem der gegebenen Werte entsprechen",
  /**
   *  When the value validates a disallowed type
   * @variables This key takes one variable: The type the value should not be of
   */
  error_disallow: "Die Eingabe muss vom Typ {{0}} sein",
  /**
   * When a value is not a multiple of or divisible by a given number
   * @variables This key takes one variable: The number mentioned above
   */
  error_multipleOf: "Die Eingabe muss ein Vielfaches von {{0}} sein",
  /**
   * When a value is greater than it's supposed to be (exclusive)
   * @variables This key takes one variable: The maximum
   */
  error_maximum_excl: "Die Eingabe muss kleiner als {{0}} sein",
  /**
   * When a value is greater than it's supposed to be (inclusive
   * @variables This key takes one variable: The maximum
   */
  error_maximum_incl: "Die Eingabe darf höchstens {{0}} sein",
  /**
   * When a value is lesser than it's supposed to be (exclusive)
   * @variables This key takes one variable: The minimum
   */
  error_minimum_excl: "Die Eingabe muss größer als {{0}} sein",
  /**
   * When a value is lesser than it's supposed to be (inclusive)
   * @variables This key takes one variable: The minimum
   */
  error_minimum_incl: "Die Eingabe muss mindestens {{0}} sein",
  /**
   * When a value have too many characters
   * @variables This key takes one variable: The maximum character count
   */
  error_maxLength: "Die Eingabe darf höchstens {{0}} Zeichen lang sein",
  /**
   * When a value does not have enough characters
   * @variables This key takes one variable: The minimum character count
   */
  error_minLength: "Die Eingabe muss mindestens {{0}} Zeichen lang sein",
  /**
   * When a value does not match a given pattern
   */
  error_pattern: "Die Eingabe muss dem gegebenen Muster entsprechen",
  /**
   * When an array has additional items whereas it is not supposed to
   */
  error_additionalItems: "In diesem Feld sind keine weiteren Elemente erlaubt",
  /**
   * When there are to many items in an array
   * @variables This key takes one variable: The maximum item count
   */
  error_maxItems: "Das Feld darf höchstens {{0}} Element(e) beinhalten",
  /**
   * When there are not enough items in an array
   * @variables This key takes one variable: The minimum item count
   */
  error_minItems: "Das Feld muss mindestens {{0}} Element(e) beinhalten",
  /**
   * When an array is supposed to have unique items but has duplicates
   */
  error_uniqueItems: "Das Feld darf nur einzigartige Elemente beinhalten",
  /**
   * When there are too many properties in an object
   * @variables This key takes one variable: The maximum property count
   */
  error_maxProperties: "Das Objekt darf höchstens {{0}} Attribute haben",
  /**
   * When there are not enough properties in an object
   * @variables This key takes one variable: The minimum property count
   */
  error_minProperties: "Das Objekt muss mindestens {{0}} Attribute haben",
  /**
   * When a required property is not defined
   * @variables This key takes one variable: The name of the missing property
   */
  error_required: "Das Objekt beinhaltet nicht das benötigte Attribut '{{0}}'",
  /**
   * When there is an additional property is set whereas there should be none
   * @variables This key takes one variable: The name of the additional property
   */
  error_additional_properties: "Es sind keine weiteren Attribute erlaubt. {{0}} muss entfernt werden",
  /**
   * When a dependency is not resolved
   * @variables This key takes one variable: The name of the missing property for the dependency
   */
  error_dependency: "Das Attribut {{0}} ist zwingend erforderlich",
  /**
   * Text on Delete All buttons
   */
  button_delete_all: "Alle",
  /**
   * Title on Delete All buttons
   */
  button_delete_all_title: "Alle löschen",
  /**
    * Text on Delete Last buttons
    * @variable This key takes one variable: The title of object to delete
    */
  button_delete_last: "Letztes {{0}}-Element",
  /**
    * Title on Delete Last buttons
    * @variable This key takes one variable: The title of object to delete
    */
  button_delete_last_title: "Letztes {{0}}-Element löschen",
  /**
    * Title on Add Row buttons
    * @variable This key takes one variable: The title of object to add
    */
  button_add_row_title: "{{0}} hinzufügen",
  /**
    * Title on Move Down buttons
    */
  button_move_down_title: "Nach unten verschieben",
  /**
    * Title on Move Up buttons
    */
  button_move_up_title: "Nach oben verschieben",
  /**
    * Title on Delete Row buttons
    * @variable This key takes one variable: The title of object to delete
    */
  button_delete_row_title: "{{0}} löschen",
  /**
    * Title on Delete Row buttons, short version (no parameter with the object title)
    */
  button_delete_row_title_short: "Löschen",
  /**
    * Title on Collapse buttons
    */
  button_collapse: "Einklappen",
  /**
    * Title on Expand buttons
    */
  button_expand: "Ausklappen"
};

@dwt
Copy link

dwt commented Apr 6, 2017

@jdorn ping - any chance you can merge this any time soon? This would be really helpful to me if merged.

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.

7 participants