- the whole file is stored in a single line
- non-ascii/accented characters are encoded in \uXXXX format
Could the translation files be stored in human-readable format?
Posted 01 June 2012 - 03:07 AM
Posted 01 June 2012 - 04:33 AM
The online JSON editor is great, thanks for the tip. I will use it.
Posted 01 June 2012 - 05:22 AM
label_send: Send ...
Then in templates I can use it like:
In the head I include and determine the langauge using this code:
require_once($config->paths->root . "site/libs/yaml/sfYaml.php"); require_once($config->paths->root . "site/libs/yaml/sfYamlParser.php"); $yaml = new sfYamlParser(); // parse language file $txt = $yaml->parse(file_get_contents($config->paths->root . "site/languages/" . $lang . ".yaml"));
I use this php yaml parser lib https://github.com/fabpot/yaml
Posted 01 June 2012 - 07:03 AM
Why? I've never had the feeling I need to edit them directly in the file.
I actually did. Why? First of all, I prefer working with larger amounts of text or code in my favourite text editor over working in a web frontend any time. Second, using search/replace mechanism would've made it much easier to keep the translation consistent. There are quite a number of phrases in the translateable files which are used two or more times. (Which, by the way, is a bit inefficient.)
I ended up not using my favourite editor (which can handle .json files) because the language .json files are minified and apparently use some kind of escaping for special characters (like German umlauts). I didn't want to risk losing work over some weird side effects of using an editor.
Posted 01 June 2012 - 07:43 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users