Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with theme translation #2899

Closed
Jimmi08 opened this issue Dec 6, 2017 · 18 comments
Closed

problem with theme translation #2899

Jimmi08 opened this issue Dec 6, 2017 · 18 comments
Labels
type: bug A problem that should not be happening
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Dec 6, 2017

I am loading LAN theme files this way:

e107::lan('theme');

In debug I can see this:
image

  • there is // instead / in path.

File exists:

image

@Moc
Copy link
Member

Moc commented Dec 6, 2017

Are the actual LAN defines loading? In other words, is it a typo in the debug message or is it an actual error in loading the file?

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Dec 6, 2017

No, theme LANs are not translated if I change languages - if you mean this.

@Moc
Copy link
Member

Moc commented Dec 6, 2017

Yep, so it's an actual bug and not a typo in the debug message. Thanks.

@Moc Moc added the type: bug A problem that should not be happening label Dec 6, 2017
@Moc Moc added this to the e107 v2.1.7 milestone Dec 6, 2017
@tgtje
Copy link
Contributor

tgtje commented Dec 7, 2017

Have an older install with a slightly changed langingzero theme;
Used> e107::lan("theme");
debug outcome : Attempting to Load: e107_themes/lz-hcd//languages/Dutch.php
This is an identical result (double //) HOWEVER if i change a piece of text (displaying front page etc. which only resides in Dutch php, it will actually be loaded (and displayed in changed form).
Multilang switching to English displays in debug : Attempting to Load: e107_themes/lz-hcd//languages/English.php (again the double //) Any textual change IS visible and displayed...(in English php)....Not saying it is a bug or a typo, for me it does work..

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Dec 7, 2017

@tgtje did you try to use theme lans in plugin template? I use it in comment template and they are not changed. See e107.sk

@tgtje
Copy link
Contributor

tgtje commented Dec 7, 2017

@Jimmi08 if understand correctly : templates used (or copied) to/IN theme ? If yes, (out of my head)
it will likely not be e107:lan(''); but e107::themeLAN( xxxxx). Will try to find any according related.( it is somewhere in files as commented text)

(idea behind as i understand, but might be wrong is the 'override' of that file which may/does exist at 2 locations...)

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Dec 7, 2017

@tgtje yes, copy of core template in theme folder. And in it theme lans are used. I was sure it was working before but maybe I am mistaken it with theme shortcodes. Only way you can load them is in theme.php, not in template file itself. Thanks for help.
Edit. And they are unique:

define('LAN_COMMENT_DISCUSSION', "Discussion"); 
define('LAN_COMMENT_BYE107', "Comment by this site"); 
define('LAN_COMMENT_BYFB', "Comment by Facebook"); 

@tgtje
Copy link
Contributor

tgtje commented Dec 7, 2017

Eh wait, else i get confused (took a Dutch php + English php> in theme folder languages).
Added define('LAN_COMMENT_DISCUSSION', "Discussion"); to Dutch php (Discussies) and the English one (Discussion).
I than added e107::lan('theme'); into comment_template.
Now for it to work i had to define (for you a button alt text i guess) that LAN... IN comment template.
I changed line 129 into
<div class="comment-box-username span2 col-xs-6 col-sm-6 col-md-6">{USERNAME} '.LAN_COMMENT_DISCUSSION.' </div>
So i was sure it would get loaded. (next to username)
NOTE!!!! the language files are on the plain level; NOT in a locale folder (eg Dutch/Dutch.php etc.> plain Dutch.php.)!!
This is the outcome:
comm3

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Dec 8, 2017

Do you add it in template file? Why is not in theme.php enough? So with more templates do you load it more times? Something like this shouldnt be in templates. I will try it. Thanks.

@Moc
Copy link
Member

Moc commented Dec 8, 2017

Jimako is right. If this works only by loading the LAN in the template files directly this is a bug. Loading them once from theme.php should be enough.

@tgtje
Copy link
Contributor

tgtje commented Dec 8, 2017

( A) call for lang file is made in template(e107::lan(t...); = method !! languages have to be loaded path).

(B)changing the template : also the new 'LAN CALL'(code) like in any other file (since it is a new LAN which is coded in file> hence a template has to reflect that). (why use a template else???)

Now when multilang, one would expect a locale folder and the lang file (eg Dutch.php etc..holding these new defines).
It seems when one uses e107::lan(theme); it DOES work BUT the (eg Dutch php) may NOT reside in a locale folder... (C) just plain in the (theme) languages folder as a flat file.. Hope it is better described

@Moc Some Dutch will be edited afterwards : ik plaats de e107::lan(t) in het template; vervolgens gebruik ik defines met een LAN die ik in het template verwerk (normale werkwijze), vervolgens MOET ik het taalbestand ( Dutch php) bijv. plaatsen in de 'root'in de languages map van het theme. Is een LAND-folder in gebruik werkt dat helaas niet..

@tgtje
Copy link
Contributor

tgtje commented Dec 8, 2017

Okay, follow up you want to add a LAN (code) in template, but make the call ( display the textual content aka define) through theme.php instead of adding it (e107::lan(t) ) to template...

Yep works too... you need to add (IN THEME php)
e107::themeLAN('','bootstrap3'); where bootstrap3 represents your themename. do NOT forget the 2 '' in front !!! (>why are they there and what they represent ????... i guess because it implements to look different ?? i really do not know, but without them, it will not work).
DO NOTE ! again for this to work, the languagefiles must be on root (theme language folder) NOT inside a locale folder... (recently discussion on use of locale folders vs plain root files where it was???) ( ps i do not see any double // in debug lines... ) ( so 2 possibilities are existing : 1 for theme, and 1 for template...e107::lan('theme'); vs `e107::themeLAN('','THEMENAME');

(ps the explanation eg use is described (commented) in e107_class php line 3191 and up,i do believe that option 1 (e107::lan('theme'); is 1-level> main languages instead of locale folder inside).

Bug ? implementation/documentation ? (advanced theme building dependencies..)

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Dec 8, 2017

This should be enough:

	 * 	// import defeinitions from /e107_themes/[currentTheme]/languages/[CurrentLanguage].php
	 * 	e107::themeLan();

this works, thank you

@tgtje
Copy link
Contributor

tgtje commented Dec 8, 2017

Nice 👍

CaMer0n added a commit that referenced this issue Dec 9, 2017
@CaMer0n
Copy link
Member

CaMer0n commented Dec 9, 2017

@Jimmi08 @tgtje
Please try e107::lan('theme'); with the fix above. Thanks.

@tgtje
Copy link
Contributor

tgtje commented Dec 9, 2017

The double slash issue is gone (debug top post); and using e107::lan('theme'); (inside theme php) working.. 👍

little sidenote: e107::themeLAN(); still does; also e107::themeLAN('','THEMENAME'); Yayy 3 options :-)

@CaMer0n
Copy link
Member

CaMer0n commented Dec 9, 2017

Thank you! Preferred method is:

e107::lan('theme');

..inside theme.php 👍

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Dec 9, 2017

Thanks to all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

No branches or pull requests

4 participants