Default value for missed language entry

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
emosbat
Registered User
Posts: 43
Joined: Fri Aug 24, 2012 8:49 am

Default value for missed language entry

Post by emosbat »

if no entry found for a language entry, default value of that variable/contant "in templates" displayed as { VARIABLE_NAME } .

if I want to check existence of that constant with a IF command, it is not possible:
https://www.phpbb.com/community/viewtop ... &t=2165224
it is mysterious that is value of that variable really { VARIABLE_NAME } or not because something like this not worked too:

Code: Select all

<!-- IF L_VARIABLE_NAME eq '{ VARIABLE_NAME }' -->OK<!-- ENDIF -->
so RFC is:
- return default value in templates as null (i mean: L_VARIABLE_NAME), when entry missed.
- it also would be nicer that before returning null value, check for entry in "default forum language" and return it as default value. in this case any missed entry will have something to display. especially missed entry in a translated MOD. for example in english we have VAR1 = 'my example', and some one translated mod to germany and missed it so we display this value instead { VAR1 } thing.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] default value for missed language entry

Post by Oleg »

Why do you want to check whether a language string is defined in templates?

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] default value for missed language entry

Post by Oleg »

Defaulting to default board language/english: https://area51.phpbb.com/phpBB/viewtopi ... ge+missing

User avatar
emosbat
Registered User
Posts: 43
Joined: Fri Aug 24, 2012 8:49 am

Re: [RFC] default value for missed language entry

Post by emosbat »

Oleg wrote:Why do you want to check whether a language string is defined in templates?
think that we have a MOD that use javascript to display important confirmation message to end-user that may cause lose of data. we pass variable to javascript to display that message. someone translate our mod and forgot to translate it. end-user get a confirmation message with something like { L_BLAH_BLAH } instead of a readable warning and loss data.

if we can check that value is null we can show a default message instead, or read it from default language and show him a readable message.
Oleg wrote:Defaulting to default board language/english: https://area51.phpbb.com/phpBB/viewtopi ... ge+missing
yes something like that.

User avatar
emosbat
Registered User
Posts: 43
Joined: Fri Aug 24, 2012 8:49 am

Re: [RFC] default value for missed language entry

Post by emosbat »

also what I think now is that it could be better to do this when debug mode is OFF. so for developer return that { L_BLAH_BLAH } when they turn ON debug to see something instead null value and do not confuse them when debugging.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] default value for missed language entry

Post by Oleg »

emosbat wrote: if we can check that value is null we can show a default message instead, or read it from default language and show him a readable message.
Defaulting to default language will then eliminate the need to check for the language string having a definition.

User avatar
emosbat
Registered User
Posts: 43
Joined: Fri Aug 24, 2012 8:49 am

Re: [RFC] default value for missed language entry

Post by emosbat »

Oleg wrote:
emosbat wrote: if we can check that value is null we can show a default message instead, or read it from default language and show him a readable message.
Defaulting to default language will then eliminate the need to check for the language string having a definition.
check in default language,
is there an entry?
case#1: yes => set as it.
case#2: no? set as null and not '{ VAR_NAME }' (if debug is off)

second case could not happen if developer set a default string for default language, but returing null instead variable name, at least, allow them to check existnce of string especially in IF commands.

we should also mean 'default language' here. if my forum is in germany so then it is default language, and missed entry should get value from english instead! yeh?! :?:

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] default value for missed language entry

Post by Oleg »

emosbat wrote: case#2: no? set as null and not '{ VAR_NAME }' (if debug is off)

second case could not happen if developer set a default string for default language, but returing null instead variable name, at least, allow them to check existnce of string especially in IF commands.
Do you have a use case for this? Your original use case will be covered by defaulting to English.
we should also mean 'default language' here. if my forum is in germany so then it is default language, and missed entry should get value from english instead! yeh?! :?:
The fallback I think is to English which I don't know if is supposed to exist on all boards or not.

Please try naderman's patch and maybe we should continue this discussion in his topic.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1903
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [RFC] default value for missed language entry

Post by DavidIQ »

emosbat wrote:- return default value in templates as null (i mean: L_VARIABLE_NAME), when entry missed.
I'm confused as I'm sure this is what phpBB does right now in 3.0. If the variable is not defined for a string then the string is returned as the variable name in all cases.
Image

User avatar
emosbat
Registered User
Posts: 43
Joined: Fri Aug 24, 2012 8:49 am

Re: [RFC] default value for missed language entry

Post by emosbat »

DavidIQ wrote:
emosbat wrote:- return default value in templates as null (i mean: L_VARIABLE_NAME), when entry missed.
I'm confused as I'm sure this is what phpBB does right now in 3.0. If the variable is not defined for a string then the string is returned as the variable name in all cases.
I meant return null for L_VARIABLE_NAME in that paragraph not returning L_VARIABLE_NAME for that variable.

Post Reply