silvioprog / brookframework

Microframework which helps to develop web Pascal applications.
https://github.com/risoflora/brookframework
GNU Lesser General Public License v3.0
171 stars 37 forks source link

i18n #151

Closed Al-Muhandis closed 6 years ago

Al-Muhandis commented 6 years ago

Hi! I saw the information in the wiki that BF supports i18n. What does this mean? I used this feature in desktop applications (language determine from machine) but in web... For example, I want all string constants (not from templates of course) from the resourcestrings section to be taken from .po file in the client / user language. I will need to use SetDefaultLang ('en'{ru/es/ar}, LangDirectory); for load .po strings?

Al-Muhandis commented 6 years ago

I made a temporary solution. The fact is that SetDefaultLanguage works only in LCL. In web app while I made such crutch that it was possible to work with files .po ` procedure TWebhookBot.LangTranslate(const ALang: String);

var L, F: String; begin if Length(ALang)>2 then L:=LeftStr(ALang, 2) else L:=ALang; F:='languages'+PathDelim+ApplicationName+'.%s.po'; TranslateResourceStrings(F, L, ''); end; `

It is also sad that the web app size after that has increased significantly. Apparently the module Translations in uses....

silvioprog commented 6 years ago

Hello @Al-Muhandis . All raised messages are assigned to global (unsafe) variables, so you can translate them using your favorite translation tool.

Al-Muhandis commented 6 years ago

@silvioprog obrigado!

silvioprog commented 6 years ago

You're welcome! :-)