fuel / docs

Fuel PHP Framework - Fuel v1.x documentation
http://fuelphp.com/docs
Other
168 stars 234 forks source link

Translations and/or localizations #573

Closed edelmoral closed 11 years ago

edelmoral commented 11 years ago

I'm a spanish developer interested in contribute translating core messages, classes and views results of the scaffolding process, etc.

the Lang Class seems to provide a translation tool for the content, not the framework itself.

I already implement an enxtend of inflector class to singularize and pluralize words in my language, but I'm lost in the rest of work.

How can I accomplish my goal in a correct "FuelPHP" way?

WanWizard commented 11 years ago

At the moment internal strings are hardcoded. Problem is that in most cases, they are error messages or exceptions, and when those happen, you don't want to be dependent on half the framework to be able to display them.

We're thinking about how to fix this for 2.0, so if you have idea's on how to implement it with a few dependencies as possible, let us know. All idea's are welcome.

edelmoral commented 11 years ago

I have several days reviewing PHP frameworks for certain development and FuelPHP has really caught my attention. The weak point I see in this framework is the internalization. Like you said, it is important to resolve with the fewest possible dependencies, but is a complete i18n task...

As a developer whose clients speak a language other than english, see the problem from another perspective. The most important thing is not error handling or development work (I guess most of us possess some knowledge of the english language that allows us to do our job). The priority for us is to have fast results in our language (for the boss, client or simply to see fast progress). Prioritize i18n to the most outstanding things, meaning: scaffolding. It's really frustrating see how fast and easy is the process (if you want the result in english) and how tedious it is to translate the result, see the code (model and controller) with plural and singular that produce disorientation, and the views displaying information that makes no sense in your language.

I really don't see yet how implement language class in the views generated by scaffold process, but that would be a REALLY great improvement, and as FuelPHP is a comunity driven framework, let the community do and share the lang files that each one requires. The inflector class must be internationalized too, specifically:

$uncountable_words, $plural_rules, $singular_rules, function ordinalize.

how far you see these initial changes?

WanWizard commented 11 years ago

For scaffolding it's not that difficult. The code is generated using views that are part of the Oil package. You can copy those views to app/views, and modify them to your liking. Oil will automatically use the views in app/views if present.

Some of the generation is in the oil code, and that is more difficult to change. For 2.0 we're busy rewriting the entire oil package, so every aspect of generation can be modified.

Making the inflector work internationally is going to be extremely difficult, as you would need all plularisation rules for every supported language. If you have ideas on how to solve that, great. I would suggest not to bother with the current 1.x codebase, and get this fixed for 2.0. You can find the new inflector in the https://github.com/fuelphp/common package. Perhaps the class can be extended to use language based drivers.

WanWizard commented 11 years ago

This issue is moved to 2.0. The logic for i18n core messages is already implemented, translations for all packages are on the way. Since oil will be rewritten for 2.0, this can be picked up as a requirement.