Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello.
Today I've seen on github that somebody has pushed some files with the translation of some strings of drupalgap. I would like to contribute with some languages if possible, since I'm not able to contribute under the pure coding aspect... lacking skills :(
If Tyler or others can give me a hint about how to to, if there are templates to use, etc, I will begin the new translations
Thanks,
Kinmen
Comments
Comment #1
tyler.frankenstein CreditAttribution: tyler.frankenstein commented@kinmen, thank you for offering to help! Here's the easiest way to contribute to DrupalGap core translations:
Add this to your settings.js file, for example (using your language code instead):
And then set the actual language code in settings.js:
From here you can add translations for DrupalGap core (we'll be adding support for contrib/custom module translation very soon). When you're done, please submit a pull request on GitHub, then we can merge in your improvements and you'll receive credit as a contributor. Otherwise, you may send me the .json file for your language(s), and I can drop them in manually. But I'd recommend taking the time to learn how to fork/clone/commit/push/pull-request on GitHub.
Comment #2
kinmen CreditAttribution: kinmen commentedOk, thank you. I'll begin to learn how github works, following your instructions. But I see that the strings in es.json and tr.json are different (inside the last there are "Confirm", "Member since", etc, in es.json those aren't written). Should I merge those 2 files (or better the strings in English from both files) to provide a complete translation? Last, are those strings just a part of the total to be translated or will be there others in the future? Thanks for your answer
K.
Comment #3
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThe language .json files are definitely incomplete, and not consistent with each other. You may add/edit translations accordingly. There are many translations missing from both, and some will have more than others, but feel free to merge them as needed, thanks.
Comment #4
kinmen CreditAttribution: kinmen commentedThanks. Last thing what about language codes of json files for Chinese? There is traditional Chinese (zh-TW) and simplified (zh-CN), how should I name the json files? Is it ok for zh-tw.json or must the encode in the name of the file be of just 2 characters?
tnx,
K.
Comment #5
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedI think the file name can be any number of characters (not just two). So you should be able to do:
chi.jsonzho.jsonThen you can use the three character string in your settings.js file. I got these language codes from here:
http://www.loc.gov/standards/iso639-2/php/code_list.phpUpdate, use these instead:
Comment #6
ptmkenny CreditAttribution: ptmkenny commentedHey Tyler, I would suggest using the Drupal 7 list of language codes instead, which gives these values for traditional/simplified Chinese:
https://api.drupal.org/api/drupal/includes%21iso.inc/function/_locale_ge...
Very happy to see the work on translations!
Comment #7
kinmen CreditAttribution: kinmen as a volunteer commentedI've just written a pull request on github for my first language file
Comment #8
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThank you @ptmkenny (Patrick), we'll now defer to the listing from Drupal that you provided when generating language code files.
@kinmen, I've merged in your pull request, thank you for the contribution!
For all, I've started a page in the docs to outline translation: http://drupalgap.org/translate
Comment #9
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedWe now have support for contrib/custom modules to provide their own translations. See the docs for more details: http://drupalgap.org/translate
Comment #10
kinmen CreditAttribution: kinmen as a volunteer commentedHello. Will there be in the future an option to let the end user chose the desired language in the (phone) application? Or a way to detect the system language of the smartphone?
Although the easier approach for the end user could be to let the smartphone chose the system language, somebody could prefer to switch to another language. I'm pretty sure somebody already have thought about that possibility, but which way will Drupalgap follow?
Comment #11
tyler.frankenstein CreditAttribution: tyler.frankenstein commented@kinmen, I picture this as a contributed module for DrupalGap. I personally would call it something like "Language Picker" and have it implement the features you mentioned. However, no clients of mine need it now, so I'll defer to anyone who wants to contribute to its resolution.
Comment #12
ptmkenny CreditAttribution: ptmkenny commented@kinmen @tyler.frankenstein I think this should be a new issue: #2491803: Language selection code examples
Comment #13
kinmen CreditAttribution: kinmen as a volunteer commentedHello.
I think that I've found a little bug. A "SyntaxError: missing : after property id" error has occurred when I've tried to include the Chinese translations in the settings.js file. I think this happened because javascript syntax doesn't like the "-" in zh-hant & zh-hans. Converting "-" in "_" in settings.js and in the name of the json files has solved the problem. If it's correct, this should be changed in Github
Comment #14
tyler.frankenstein CreditAttribution: tyler.frankenstein commented@kinmen yes, that is correct, we should not be using a hyphen in an object's property name, and converting to an underscore would likely solve it. Will you please file an issue and/or pull request with the SDK to resolve this?
Comment #15
kinmen CreditAttribution: kinmen as a volunteer commentedYes, I'll issue a pull request to your Github
Comment #16
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedPull request merged.