cubiclesoft / jquery-fancyfileuploader

A jQuery plugin to convert the HTML file input type into a fancy file uploader under a MIT or LGPL license. Mobile-friendly too!
58 stars 27 forks source link

Feature Request: Better multilanguage support #18

Closed Woersty closed 3 years ago

Woersty commented 3 years ago

Hi Thomas, it's a bit difficult to dig into the source code to find the strings to replace for multilanguage support.

I have done it so far but would highly appreciate it if you could convert the strings to variables and summarize them in an external file for easier translation.

I would do it and send you a merge request If you want. 😀

PS: Great little Repository - I like it. ❤️ Not too overloaded and easy to implement and understand. 👍

Best regards Wörsty (Christian)

cubiclesoft commented 3 years ago

I don't like string substitutions for default language fallbacks. That's how to wind up with showing placeholders in strings to end users (e.g. "Hello {{FIRSTNAME}}, ..." where some software failed to replace {{FIRSTNAME}} with someone's first name). Translate(), as-is, is my preferred way to handle language translations. Write code inline in native tongue, then let the Translate() wrapper handle the rest. Otherwise, I have to scour the language map for the string to find the key and THEN go find the relevant code that uses the key. That kind of reverse-information lookup generally wastes a ton of time. Finding all of the Translate() calls is easy enough for anyone wanting to write a translation map and, as the software changes (especially changes to strings), I don't have to worry about translations resulting in weird failures.

FlexForms/Admin Pack XX_Translate() on the PHP side has the option to catch untranslated strings via a callback to write to disk somewhere.

The actual problem is that no one has submitted any language packs. If a user can grab an existing language pack, then that would be mostly sufficient for making new ones.

Woersty commented 3 years ago

It's okay for me if you won't integrate it. However I use my fork code in my project - so I had to code it because of the template system I use. I see no problem why {{FIRSTNAME}} should be shown in any circumstances because of the fallback but it's on you. 😉

If you feel better you can keep it.

Woersty commented 3 years ago

PS: If someone is interested, he can use the rejected code... Do you want the German translations for PHP too? I have not uploaded them yet.

cubiclesoft commented 3 years ago

German language pack applied to the repository.

In general, significant changes to the design of the software are better approached by asking first. Asking how to do something before forking and making a bunch of changes in a pull request that will get rejected saves everyone a lot of time. There's a preferred way to do multilingual translations that is already included in CubicleSoft software even if there's some disagreement on the implementation.

The server-side is intentionally less complete. CS_TRANSLATE_FUNC is intended to be a generic function that is defined once and called to properly translate strings as part of a language loader for the whole application in a style similar to the Admin Pack language loader. Most applications already have their own language loaders, so this is intended for side-loading additional strings into the existing language mapper.

Closing as complete.