Welcome Guest, Not a member yet? Register   Sign In
Language problem in Production [solved]
#1

(This post was last modified: 10-18-2020, 12:28 PM by jaydee.)

Hi!

I am building a web app and everything works on localhost. I deployed on aws today (for the first time) and the localization does not work anymore. The page just renders the strings for the lang() function, e.g. 'App.Menu.Proejcts' instead of 'Projects' in different languages. intl extension is loaded on the server (this is from phpinfo):
intl
Internationalization support
enabled
version 1.1.0
ICU version 50.2
ICU Data version 50.2
ICU TZData version 2018e
ICU Unicode version 6.2


php 7.2.33

Language files are in place, they are chmoded to 755 (just to be sure they are visible to the app). What could be wrong? Nothing in the logs...

Thanks in advance!
Angel
Reply
#2

(This post was last modified: 10-15-2020, 11:45 PM by InsiteFX.)

Server Requirements
PHP version 7.2 or newer is required, with the *intl* extension and *mbstring* extension installed.

The following PHP extensions should be enabled on your server: 

Code:
php-json php-mysqlnd php-xml
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Yep, I checked it. All of them are installed.
Reply
#4

Sounds like it has to do with some way that the live server is setup for,
since you said it works on localhost.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

Maybe i had simillar issue. It was all on dev server, ubuntu 20.04. Language files, arrays, strings and translations - was working perfectly. I wanted to implement admin panel translation module, which would basically save multi-dimentional array back to files. This was a bad idea as git repos would ruin this anyway.
Once translation array was saved back to the file, correct php, then codeigniter somehow undertood that language file as broken, messed up and couldn't see / read it. Therefore translations did not work.
I could copy php array out to another text editor, delete the file, create empty file, copy back php array - and everything worked again.

Maybe this exp will help you.
Reply
#6

Nothing works... Sad I removed the whole Language directory, added one EN file in vim, added just one line, then all lines, chmoded the file 755, then 777, then 644. Nothing changes on the frontend. It looks like the system just doesn't see the language files.
Reply
#7

You can check with the debug toolbar if your language files are loaded or not. Also make sure to name your file correctly: first letter is uppercase and the rest is lowercase. Like this app/Language/en/Validation.php If your test server is on Windows it will probably work even if it's not correct. But the file systems on Linux is case sensitive. So it's important to name the files correctly.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#8

(10-18-2020, 10:21 AM)includebeer Wrote: You can check with the debug toolbar if your language files are loaded or not. Also make sure to name your file correctly: first letter is uppercase and the rest is lowercase. Like this app/Language/en/Validation.php If your test server is on Windows it will probably work even if it's not correct. But the file systems on Linux is case sensitive. So it's important to name the files correctly.
Thanks, man! This one worked like a charm! I didn't even think about it. My language files were 'app.php', now they are 'App.php'.
But strange that unix on my MacOS X worked with the files 'app.php'.
Reply
#9

(10-18-2020, 12:27 PM)jaydee Wrote:
(10-18-2020, 10:21 AM)includebeer Wrote: You can check with the debug toolbar if your language files are loaded or not. Also make sure to name your file correctly: first letter is uppercase and the rest is lowercase. Like this app/Language/en/Validation.php If your test server is on Windows it will probably work even if it's not correct. But the file systems on Linux is case sensitive. So it's important to name the files correctly.
Thanks, man! This one worked like a charm! I didn't even think about it. My language files were 'app.php', now they are 'App.php'.
But strange that unix on my MacOS X worked with the files 'app.php'.

This was driving me crazy - thank you for publishing your solution.

I had the same issue with pushing to AWS from localhost. None of my language files appeared to exist anymore. 

However, my Language files started with the capital letter already. For example, I would have app/Languages/en/Default.php and it still did not work. I found that I had to uppercase the folder, so it became app/Languages/En/Default.php.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB