Forum > Translations
Show 'Language-Team' value of po file in application
(1/1)
stem:
Hi,
with Poedit you can add in the properties a 'Language-Team'. How can I easily show the value of the 'Language-Team' for the currently selected translation in my application? Thank you!
stem
stem:
No ideas? :'(
;)
wp:
In unit "Translations" you can find a class TPoFile which reads the entire file. Property Header contains the name of the last translator and the name of the team. The following code extracts this information from the header:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses Translations; procedure ShowTranslationInfo(AFileName: String; out Team, Translator: String);var pofile: TPoFile; L: TStringList; i: Integer; sa: TStringArray;begin L := TStringList.Create; try pofile := TPoFile.Create(AFileName); try L.Text := pofile.Header.Translation; finally pofile.Free; end; for i := 0 to L.Count - 1 do begin sa := L[i].Split(':'); if (Length(sa) = 2) then case sa[0] of 'Last-Translator' : Translator := Trim(sa[1]); 'Language-Team' : Team := Trim(sa[1]); end; end; finally L.Free; end;end;
stem:
Thank you!
Navigation
[0] Message Index